Back to VDocs
OpenFromWordMethod
Definition
- Namespace
- DOM
- Assembly
- VDocs.dll
Opens an existing Word document using a static factory method.
VDocs OpenFromWord(string filename)Parameters
- filename
- The full path to the Word document (.docx) to open.
Remarks
This is a convenience factory method that provides a more fluent API for opening documents. It is functionally equivalent to the constructor. constructor(string)
Examples
csharp
1// Open a document using the factory method
2var doc = VDocs.OpenFromWord("C:\\Documents\\report.docx");
3
4// Modify and save
5var paragraphs = doc.Paragraphs;
6foreach (var p in paragraphs)
7{
8 p.Text = p.Text.Replace("OLD", "NEW");
9}
10doc.SaveAsWord("C:\\Documents\\report_updated.docx");
11