Add checkbox and picture content control to word document in C#
Besides the Combo Box, Text, Date Picker and Drop-Down List content controls, Checkbox and picture content control also are the mostly used content control in word document. Spire.Doc supports to add many kinds of content controls to the word document. This article will show you how to add checkbox and picture content control to word document by Spire.Doc for .NET.
Code snippets of how to add checkbox and picture content control:
using System;
using System.Drawing;
namespace AddCheckbox
{
class Program
{
static void Main(string[] args)
{
//Create a new word document
Document document = new Document();
//Add a section to the document
Section section = document.AddSection();
//Add a document to the section
Paragraph paragraph = section.AddParagraph();
//Add checkbox content control
StructureDocumentTagInline sdt = new StructureDocumentTagInline(document);
paragraph = section.AddParagraph();
sdt = new StructureDocumentTagInline(document);
sdt.CharacterFormat.FontSize = 20;
paragraph.ChildObjects.Add(sdt);
sdt.SDTProperties.SDTType = SdtType.CheckBox;
SdtCheckBox scb = new SdtCheckBox();
sdt.SDTProperties.ControlProperties = scb;
TextRange tr = new TextRange(document);
tr.CharacterFormat.FontName = "MS Gothic";
tr.CharacterFormat.FontSize = 20;
sdt.ChildObjects.Add(tr);
scb.Checked = true;
sdt.SDTProperties.Alias = "CheckoBox";
sdt.SDTProperties.Tag = "Checkbox";
//Add picture content control
paragraph = section.AddParagraph();
sdt = new StructureDocumentTagInline(document);
paragraph.ChildObjects.Add(sdt);
sdt.SDTProperties.ControlProperties = new SdtPicture();
sdt.SDTProperties.Alias = "Picture";
sdt.SDTProperties.Tag = "Picture";
DocPicture pic = new DocPicture(document) { Width = 10, Height = 10 };
pic.LoadImage(Image.FromFile("Logo.jpg"));
sdt.SDTContent.ChildObjects.Add(pic);
document.SaveToFile("Sample.docx", FileFormat.Docx2013);
}
}
}
Effective screenshot after adding checkbox and picture content control to word document:

C#/VB.NET: Detect and Remove VBA Macros from Word Documents
VBA (Visual Basic for Applications) macros are small programs that can be embedded within Microsoft Word documents to automate repetitive tasks, add interactivity to documents, and perform other useful functions. While macros can be beneficial in many situations, they can also pose a security risk if the code is malicious or contains malware. By removing VBA macros from Word documents, you can reduce the risk of security breaches and malware infections. In this article, you will learn how to detect and remove VBA macros from Word documents in C# and VB.NET using Spire.Doc for .NET library.
Install Spire.Doc for .NET
To begin with, you need to add the DLL files included in the Spire.Doc for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Doc
Detect and Remove VBA Macros from Word Documents in C# and VB.NET
You can use the Document.IsContainMacro property to detect whether a Word document contains VBA macros. If any macros are detected, you can use the Document.ClearMacros() method to easily remove them from the document.
The following steps show how to detect and remove VBA macros from a Word document using Spire.Doc for .NET:
- Initialize an instance of the Document class.
- Load a Word document using the Document.LoadFromFile(string fileName) method.
- Detect if the document contains VBA macros using the Document.IsContainMacro property.
- If any macros are detected, remove them from the document using Document.ClearMacros() method.
- Save the result document using Document.SaveToFile(string fileName, FileFormat fileFormat) method.
- C#
- VB.NET
using Spire.Doc;
namespace RemoveVBAMacros
{
internal class Program
{
static void Main(string[] args)
{
//Initialize an instance of the Document class
Document document = new Document();
//Load a Word document
document.LoadFromFile("Input.docm");
//Detect if the document contains macros
if (document.IsContainMacro)
{
//Remove the macros from the document
document.ClearMacros();
}
//Save the result document
document.SaveToFile("RemoveMacros.docm", FileFormat.Docm);
document.Close();
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
How to clone a word document in C#
With Spire.Doc, we can copy the content from one word document to another word document in C#. When we need to generate a large amount of documents from a single document, clone the document will be much easier. The clone method speeds up the generation of the word documents and developers only need one single line of code to get the copy of the word document.
Now we will show the code snippet of how to clone a word document in C#.
Step 1: Create a new instance of Document and load the document from file.
Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2010);
Step 2: Clone the word document.
doc.Clone();
Step 3: Save the document to file.
doc.SaveToFile("Cloneword.docx", FileFormat.Docx2010);
Effective screenshot of clone the word document:

Full codes of clone a word document:
using Spire.Doc;
namespace CloneWord
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile("Sample.docx", FileFormat.Docx2010);
doc.Clone();
doc.SaveToFile("Cloneword.docx", FileFormat.Docx2010);
}
}
}
Add, Count, Retrieve and Remove Variables in a Word document Using C#
Document variables are used to preserve macro settings in between macro sessions. Spire.Doc allows adding variables, counting the number of variables, retrieving the name and value of variables, and removing specific variables in a Word document.
Add a Variable
Use the Add method to add a variable to a document. The following example adds a document variable named "A1" with a value of 12 to the document.
using Spire.Doc;
using Spire.Doc.Documents;
namespace ADDVARIABLE
{
class Program
{
static void Main(string[] args)
{
//Instantiate a document object
Document document = new Document();
//Add a section
Section section = document.AddSection();
//Add a paragraph
Paragraph paragraph = section.AddParagraph();
//Add a DocVariable Filed
paragraph.AppendField("A1", FieldType.FieldDocVariable);
//Add a document variable to the DocVariable Filed
document.Variables.Add("A1", "12");
//Update fields
document.IsUpdateFields = true;
//Save and close the document object
document.SaveToFile("AddVariable.docx", FileFormat.Docx2013);
document.Close();
}
}
}

Count the number of Variables
Use the Count property to return the number of variables in a document.
//Load the document
Document document = new Document("AddVariable.docx");
//Get the number of variables in the document
int number = document.Variables.Count;
Console.WriteLine(number);

Retrieve Name and Value of a Variable
Use the GetNameByIndex and GetValueByIndex methods to retrieve the name and value of the variable by index, and the Variables[String Name] to retrieve or set the value of the variable by name.
using Spire.Doc;
using Spire.Doc.Documents;
using System;
namespace COUNTVARIABLE
{
class Program
{
static void Main(string[] args)
{
//Load the document
Document document = new Document("AddVariable.docx");
//Get the number of variables in the document
int number = document.Variables.Count;
Console.WriteLine(number);
}
}
}

Remove a specific Variable
Use the Remove method to remove the variable from the document.
using Spire.Doc;
using System;
namespace RETRIEVEVARIABLE
{
class Program
{
static void Main(string[] args)
{
//Load the document
Document document = new Document("AddVariable.docx");
// Retrieve name of the variable by index
string s1 = document.Variables.GetNameByIndex(0);
// Retrieve value of the variable by index
string s2 = document.Variables.GetValueByIndex(0);
// Retrieve or set value of the variable by name
string s3 = document.Variables["A1"];
Console.WriteLine("{0} {1} {2}", s1, s2, s3);
}
}
}
How to enable track changes of the word document
The track changes has been used to keep track of the every changes that made to the Word document. It helps to record every edit, insertion, deletion, or modification in a word document. We have demonstrated how to accept/reject the tracked changes on word document in C#. This article will show you how to enable track changes of the document.
Step 1: Create a new word document and load the document from file.
Document document = new Document();
document.LoadFromFile("Sample.docx", FileFormat.Docx2010);
Step 2: Enable the track changes.
document.TrackChanges = true;
Step 3: Save the document to file.
document.SaveToFile("Enable Trackchanges.docx", FileFormat.Docx2010);
Effective screenshot:

Full codes:
using Spire.Doc;
namespace EnableTrack
{
class Program
{
static void Main(string[] args)
{
Document document = new Document();
document.LoadFromFile("Sample.docx", FileFormat.Docx2010);
document.TrackChanges = true;
document.SaveToFile("Enable Trackchanges.docx", FileFormat.Docx2010);
}
}
}
C#/VB.NET: Accept or Reject Tracked Changes in Word
Track Changes in MS Word can track the revisions, corrections, changes, edits, and even suggestions and comments people make to documents. When you receive a revised document with Track Changes turned on, you can decide whether to reject the changes to keep the original content or directly accept them. This article will demonstrate how to programmatically accept or reject all tracked changes in a Word document using Spire.Doc for .NET.
Install Spire.Doc for .NET
To begin with, you need to add the DLL files included in the Spire.Doc for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Doc
Accept All Tracked Changes in a Word Document
The detailed steps are as follows:
- Create a Document instance.
- Load a sample Word document using Document.LoadFromFile() method.
- Accept all changes in the document using Document.AcceptChanges() method.
- Save the document to another file using Document.SaveToFile() method.
- C#
- VB.NET
using Spire.Doc;
namespace AcceptTrackedChanges
{
class Program
{
static void Main(string[] args)
{
//Create a Document instance
Document doc = new Document();
//Load a sample Word document
doc.LoadFromFile("test.docx");
//Accept all changes in the document
doc.AcceptChanges();
//Save the result document
doc.SaveToFile("AcceptTrackedChanges.docx", FileFormat.Docx);
}
}
}

Reject All Tracked Changes in a Word document
The detailed steps are as follows.
- Create a Document instance.
- Load a sample Word document using Document.LoadFromFile() method.
- Reject all changes in the document using Document.RejectChanges() method.
- Save the document to another file using Document.SaveToFile() method.
- C#
- VB.NET
using Spire.Doc;
namespace RejectTrackedChanges
{
class Program
{
static void Main(string[] args)
{
//Create a Document instance
Document doc = new Document();
//Load a sample Word document
doc.LoadFromFile("test.docx");
//Reject all changes in the document
doc.RejectChanges();
//Save the result document
doc.SaveToFile("RejectAllChanges.docx", FileFormat.Docx);
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
C#/VB.NET: Split Word Documents
In MS Word, you can split a document by manually cutting the content from the original document and pasting it into a new document. Although the task is simple, it can also be quite tedious and time-consuming especially when dealing with a long document. This article will demonstrate how to programmatically split a Word document into multiple files using Spire.Doc for .NET .
Install Spire.Doc for .NET
To begin with, you need to add the DLL files included in the Spire.Doc for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Doc
Split a Word Document by Page Break
A Word document can contain multiple pages separated by page breaks. To split a Word document by page break, you can refer to the below steps and code.
- Create a Document instance.
- Load a sample Word document using Document.LoadFromFile() method.
- Create a new Word document and add a section to it.
- Traverse through all body child objects of each section in the original document and determine whether the child object is a paragraph or a table.
- If the child object of the section is a table, directly add it to the section of new document using Section.Body.ChildObjects.Add() method.
- If the child object of the section is a paragraph, first add the paragraph object to the section of the new document. Then traverse through all child objects of the paragraph and determine whether the child object is a page break.
- If the child object of the paragraph is a page break, get its index and then remove the page break from its paragraph by index.
- Save the new Word document and then repeat the above processes.
- C#
- VB.NET
using System;
using Spire.Doc;
using Spire.Doc.Documents;
namespace SplitByPageBreak
{
class Program
{
static void Main(string[] args)
{
//Create a Document instance
Document original = new Document();
//Load a sample Word document
original.LoadFromFile(@"E:\Files\SplitByPageBreak.docx");
//Create a new Word document and add a section to it
Document newWord = new Document();
Section section = newWord.AddSection();
int index = 0;
//Traverse through all sections of the original document
foreach (Section sec in original.Sections)
{
//Traverse through all body child objects of each section
foreach (DocumentObject obj in sec.Body.ChildObjects)
{
if (obj is Paragraph)
{
Paragraph para = obj as Paragraph;
sec.CloneSectionPropertiesTo(section);
//Add paragraph object in the section of original document into section of new document
section.Body.ChildObjects.Add(para.Clone());
//Traverse through all child objects of each paragraph and determine whether the object is a page break
foreach (DocumentObject parobj in para.ChildObjects)
{
if (parobj is Break && (parobj as Break).BreakType == BreakType.PageBreak)
{
//Get the index of page break in paragraph
int i = para.ChildObjects.IndexOf(parobj);
//Remove the page break from its paragraph
section.Body.LastParagraph.ChildObjects.RemoveAt(i);
//Save the new Word document
newWord.SaveToFile(String.Format("result\out-{0}.docx", index), FileFormat.Docx);
index++;
//Create a new document and add a section
newWord = new Document();
section = newWord.AddSection();
//Add paragraph object in original section into section of new document
section.Body.ChildObjects.Add(para.Clone());
if (section.Paragraphs[0].ChildObjects.Count == 0)
{
//Remove the first blank paragraph
section.Body.ChildObjects.RemoveAt(0);
}
else
{
//Remove the child objects before the page break
while (i >= 0)
{
section.Paragraphs[0].ChildObjects.RemoveAt(i);
i--;
}
}
}
}
}
if (obj is Table)
{
//Add table object in original section into section of new document
section.Body.ChildObjects.Add(obj.Clone());
}
}
}
//Save to file
newWord.SaveToFile(String.Format("result/out-{0}.docx", index), FileFormat.Docx);
}
}
}

Split a Word Document by Section Break
In Word, a section is a part of a document that contains its own page formatting. For documents that contain multiple sections, Spire.Doc for .NET also supports splitting documents by section breaks. The detailed steps are as follows.
- Create a Document instance.
- Load a sample Word document using Document.LoadFromFile() method.
- Define a new Word document object.
- Traverse through all sections of the original Word document.
- Clone each section of the original document using Document.Sections.Clone() method.
- Add the cloned section to the new document as a new section using Document.Sections.Add() method.
- Save the result document using Document.SaveToFile() method.
- C#
- VB.NET
using System;
using Spire.Doc;
namespace SplitBySectionBreak
{
class Program
{
static void Main(string[] args)
{
//Create a Document instance
Document document = new Document();
//Load a sample Word document
document.LoadFromFile(@"E:\Files\SplitBySectionBreak.docx");
//Define a new Word document object
Document newWord;
//Traverse through all sections of the original Word document
for (int i = 0; i < document.Sections.Count; i++)
{
newWord = new Document();
//Clone each section of the original document and add it to the new document as new section
newWord.Sections.Add(document.Sections[i].Clone());
//Save the result document
newWord.SaveToFile(String.Format(@"test\out_{0}.docx", i));
}
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Split a Word document into multiple documents by section break in C#
In Word, we can split a word document in an easiest way - open a copy of the original document, delete the sections that we don’t want and then save the remains to local drive. But doing this section by section is rather cumbersome and boring. This article will explain how we can use Spire.Doc for .NET to programmatically split a Word document into multiple documents by section break instead of copying and deleting manually.
Detail steps and code snippets:
Step 1: Initialize a new word document object and load the original word document which has two sections.
Document document = new Document();
document.LoadFromFile("Test.docx");
Step 2: Define another new word document object.
Document newWord;
Step 3: Traverse through all sections of the original word document, clone each section and add it to a new word document as new section, then save the document to specific path.
for (int i = 0; i < document.Sections.Count; i++)
{
newWord = new Document();
newWord.Sections.Add(document.Sections[i].Clone());
newWord.SaveToFile(String.Format(@"test\out_{0}.docx", i));
}
Run the project and we'll get the following output:

Full codes:
using System;
using Spire.Doc;
namespace Split_Word_Document
{
class Program
{
static void Main(string[] args)
{
Document document = new Document();
document.LoadFromFile("Test.doc");
Document newWord;
for (int i = 0; i < document.Sections.Count; i++)
{
newWord = new Document();
newWord.Sections.Add(document.Sections[i].Clone());
newWord.SaveToFile(String.Format(@"test\out_{0}.docx", i));
}
}
}
}
C#: Copy Content from One Word Document to Another
Transferring content between Microsoft Word documents is a frequent need for many users. Whether you're consolidating information from multiple sources or reorganizing the structure of a document, being able to effectively copy and paste text, graphics, and formatting is crucial.
This article demonstrates how to copy content from one Word document to another using C# and Spire.Doc for .NET.
- Copy Specified Paragraphs from One Word Document to Another
- Copy a Section from One Word Document to Another
- Copy the Entire Document and Append it to Another
- Create a Copy of a Word Document
Install Spire.Doc for .NET
To begin with, you need to add the DLL files included in the Spire.Doc for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Doc
Copy Specified Paragraphs from One Word Document to Another in C#
With Spire.Doc library for .NET, you can clone individual paragraphs using the Paragraph.Clone() method, and then add the cloned paragraphs to a different Word document using the ParagraphCollection.Add() method. This allows you to selectively copy and transfer content between documents.
To copy specified paragraphs from one Word document to another, follow these steps:
- Create a Document object to load the source file.
- Create another Document object to load the target file.
- Get the specified paragraphs from the source file.
- Clone these paragraphs using Paragraph.Clone() method.
- Add the cloned paragraphs to the target file using ParagraphCollection.Add() method.
- Save the target file to a different Word file.
- C#
using Spire.Doc;
using Spire.Doc.Documents;
namespace CopyParagraphs
{
class Program
{
static void Main(string[] args)
{
// Create a Document object
Document sourceDoc = new Document();
// Load the source file
sourceDoc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\source.docx");
// Get the specified paragraphs from the source file
Paragraph p1 = sourceDoc.Sections[0].Paragraphs[8];
Paragraph p2 = sourceDoc.Sections[0].Paragraphs[9];
// Create another Document object
Document targetDoc = new Document();
// Load the target file
targetDoc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\target.docx");
// Get the last section
Section lastSection = targetDoc.LastSection;
// Add the paragraphs from the soure file to the target file
lastSection.Paragraphs.Add((Paragraph)p1.Clone());
lastSection.Paragraphs.Add((Paragraph)p2.Clone());
// Save the target file to a different Word file
targetDoc.SaveToFile("CopyParagraphs.docx", FileFormat.Docx2019);
// Dispose resources
sourceDoc.Dispose();
targetDoc.Dispose();
}
}
}

Copy a Section from One Word Document to Another in C#
A section in a Word document can contain not only paragraphs, but also other elements such as tables. To copy an entire section from one Word document to another, you need to iterate through all the child objects within the section and add them individually to a specified section in the target document.
The steps to copy a section between different Word documents are:
- Create Document objects to load the source file and the target file, respectively.
- Get the specified section from the source file.
- Iterate through the child objects in the section, and clone these objects using DocumentObject.Clone() method.
- Add the cloned child objects to a specified section of the target file using DocumentObjectCollection.Add() method.
- Save the updated target file to a new file.
- C#
using Spire.Doc;
namespace CopySection
{
class Program
{
static void Main(string[] args)
{
// Create a Document object
Document sourceDoc = new Document();
// Load the source file
sourceDoc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\source.docx");
// Get the specified section from the source file
Section section = sourceDoc.Sections[0];
// Create another Document object
Document targetDoc = new Document();
// Load the target file
targetDoc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\target.docx");
// Get the last section of the target file
Section lastSection = targetDoc.LastSection;
// Iterate through the child objects in the selected section
foreach (DocumentObject obj in section.Body.ChildObjects)
{
// Add the child object to the last section of the target file
lastSection.Body.ChildObjects.Add(obj.Clone());
}
// Save the target file to a different Word file
targetDoc.SaveToFile("CopySection.docx", FileFormat.Docx2019);
// Dispose resources
sourceDoc.Dispose();
targetDoc.Dispose();
}
}
}
Copy the Entire Document and Append it to Another in C#
To copy the full contents from one Word document into another, you can use the Document.InsertTextFromFile() method. This method appends the source document's contents to the target document, starting on a new page.
The steps to copy the entire document and append it to another are as follows:
- Create a Document object.
- Load a Word file (target file) from the given file path.
- Insert content of a different Word document to the target file using Document.InsertTextFromFile() method.
- Save the updated target file to a new Word document.
- C#
using Spire.Doc;
namespace CopyEntireDocument
{
class Program
{
static void Main(string[] args)
{
// Specify the path of the source document
String sourceFile = "C:\\Users\\Administrator\\Desktop\\source.docx";
// Create a Document object
Document targetDoc = new Document();
// Load the target file
targetDoc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\target.docx");
// Insert content of the source file to the target file
targetDoc.InsertTextFromFile(sourceFile, FileFormat.Docx);
// Save the target file to a different Word file
targetDoc.SaveToFile("CopyEntireDocuemnt.docx", FileFormat.Docx2019);
// Dispose resources
targetDoc.Dispose();
}
}
}
Create a Copy of a Word Document in C#
Using Spire.Doc library for .NET, you can leverage the Document.Clone() method to easily duplicate a Word document.
Here are the steps to create a copy of a Word document:
- Create a Document object.
- Load a Word file from the given file path.
- Clone the file using Document.Clone() method.
- Save the cloned document to a new Word file.
- C#
using Spire.Doc;
namespace CloneWordDocument
{
class Program
{
static void Main(string[] args)
{
// Create a new document object
Document sourceDoc = new Document();
// Load a Word file
sourceDoc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.docx");
// Clone the document
Document newDoc = sourceDoc.Clone();
// Save the cloned document as a docx file
newDoc.SaveToFile("Copy.docx", FileFormat.Docx);
// Dispose resources
sourceDoc.Dispose();
newDoc.Dispose();
}
}
}
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
How to Download a Word Document from URL in C#, VB.NET
Nowadays, we're facing a bigger chance to download a file from URL since more documents are electronically delivered by internet. In this article, I'll introduce how to download a Word document from URL programmatically using Spire.Doc in C#, VB.NET.
Spire.Doc does not provide a method to download a Word file directly from URL. However, you can download the file from URL into a MemoryStream and then use Spire.Doc to load the document from MemoryStream and save as a new Word document to local folder.
Code Snippet:
Step 1: Initialize a new Word document.
Document doc = new Document();
Step 2: Initialize a new instance of WebClient class.
WebClient webClient = new WebClient();
Step 3: Call WebClient.DownloadData(string address) method to load the data from URL. Save the data to a MemoryStream, then call Document.LoadFromStream() method to load the Word document from MemoryStream.
using (MemoryStream ms = new MemoryStream(webClient.DownloadData("http://www.e-iceblue.com/images/test.docx")))
{
doc.LoadFromStream(ms,FileFormat.Docx);
}
Step 4: Save the file.
doc.SaveToFile("result.docx",FileFormat.Docx);
Run the program, the targeted file will be downloaded and saved as a new Word file in Bin folder.

Full Code:
using Spire.Doc;
using System.IO;
using System.Net;
namespace DownloadfromURL
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
WebClient webClient = new WebClient();
using (MemoryStream ms = new MemoryStream(webClient.DownloadData("http://www.e-iceblue.com/images/test.docx")))
{
doc.LoadFromStream(ms, FileFormat.Docx);
}
doc.SaveToFile("result.docx", FileFormat.Docx);
}
}
}
Imports Spire.Doc
Imports System.IO
Imports System.Net
Namespace DownloadfromURL
Class Program
Private Shared Sub Main(args As String())
Dim doc As New Document()
Dim webClient As New WebClient()
Using ms As New MemoryStream(webClient.DownloadData("http://www.e-iceblue.com/images/test.docx"))
doc.LoadFromStream(ms, FileFormat.Docx)
End Using
doc.SaveToFile("result.docx", FileFormat.Docx)
End Sub
End Class
End Namespace