Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Document-Processing/Word/Word-Library/NET/Support-File-Formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ The following table describes the supported file formats and their conversions i
</tr>
<tr>
<th>
{{'[DOC](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#word-binary-97-2003-format)'| markdownify }}
DOC
</th>
<th>
{{'[DOCX](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#doc-to-docx-and-docx-to-doc)'| markdownify }}
{{'[DOCX](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-console-application#open-and-save-word-document-using-net-core-and-latest)'| markdownify }}
</th>
<th>
{{'[Word Processing XML (2007)](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#word-open-xml-formats-2007--later)'| markdownify }}
{{'[Word Processing XML (2007)]()'| markdownify }}
</th>
<th>
{{'[DOT](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#templates)'| markdownify }}
DOT
</th>
<th>
{{'[DOTX](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#templates)'| markdownify }}
DOTX
</th>
<th>
{{'[DOCM](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#macros)'| markdownify }}
DOCM
</th>
<th>
{{'[DOTM](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#macros)'| markdownify }}
DOTM
</th>
<th>
{{'[ODT](https://help.syncfusion.com/document-processing/word/word-library/net/word-to-odt)'| markdownify }}
Expand All @@ -62,7 +62,7 @@ The following table describes the supported file formats and their conversions i
</th>
</tr>
<tr>
<th>{{'[DOC](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#word-binary-97-2003-format)'| markdownify }}</th>
<th>DOC</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -79,7 +79,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[DOCX](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#doc-to-docx-and-docx-to-doc)'| markdownify }}</th>
<th>{{'[DOCX](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-console-application#open-and-save-word-document-using-net-core-and-latest)'| markdownify }}</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -96,7 +96,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[Word Processing XML (2003)](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#word-processing-xml-xml)'| markdownify }}</th>
<th>Word Processing XML (2003)</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -113,7 +113,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[Word Processing XML (2007)](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#word-open-xml-formats-2007--later)'| markdownify }}</th>
<th>{{'[Word Processing XML (2007)]()'| markdownify }}</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -130,7 +130,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[DOT](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#templates)'| markdownify }}</th>
<th>DOT</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -147,7 +147,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[DOTX](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#templates)'| markdownify }}</th>
<th>DOTX</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -164,7 +164,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[DOCM](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#macros)'| markdownify }}</th>
<th>DOCM</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand All @@ -181,7 +181,7 @@ The following table describes the supported file formats and their conversions i
<td>Yes</td>
</tr>
<tr>
<th>{{'[DOTM](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#macros)'| markdownify }}</th>
<th>DOTM</th>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
Expand Down
107 changes: 107 additions & 0 deletions Document-Processing/Word/Word-Library/NET/wordml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
title: Convert Word to WordML file and vice versa in C# | Syncfusion
description: Learn how to convert Word document to WordML file and vice versa using the .NET Word (DocIO) library without Microsoft Word or interop dependencies.
platform: document-processing
control: DocIO
documentation: UG
---

# WordML Conversions in Word Library

The Essential<sup>&reg;</sup> DocIO converts the Word document into WordML file and vice versa.

## Convert Word to WordML

The following code example shows how to convert the Word document into WordML file.

N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/refs/heads/main/WordML-conversion/Convert-Word-to-WordML/.NET/Convert-Word-to-WordML/Program.cs" %}
FileStream fileStreamPath = new FileStream("Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
//Loads an existing Word document into DocIO instance
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
//Creates file stream
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.xml"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the loaded document in WordML format to the output stream
document.Save(outputFileStream, FormatType.WordML);
//Closes the Word document
document.Close();
}
}
}
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Loads a template document
WordDocument document = new WordDocument("Template.docx");
//Saves the document as WordML file
document.Save("WordToWordML.xml", FormatType.WordML);
//Closes the document
document.Close();
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Loads a template document
Dim document As New WordDocument("Template.docx")
'Saves the document as WordML file
document.Save("WordToWordML.xml", FormatType.WordML)
'Closes the document
document.Close()
{% endhighlight %}

{% endtabs %}

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/WordML-conversion/Convert-Word-to-WordML/.NET).

## Convert WordML to Word

The following code example shows how to convert a WordML file into Word document.

{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/refs/heads/main/WordML-conversion/Convert-WordML-to-Word/.NET/Convert-WordML-to-Word/Program.cs" %}
FileStream fileStreamPath = new FileStream("Template.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
//Loads an existing WordML file into DocIO instance
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.xml"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.WordML))
{
//Creates file stream
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
//Closes the Word document
document.Close();
}
}
}
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Loads a WordML file
WordDocument document = new WordDocument("Template.xml");
//Saves the document as Word document
document.Save("WordMLToWord.docx", FormatType.Docx);
//Closes the document
document.Close();
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Loads a WordML file
Dim document As New WordDocument("Template.xml")
'Saves the document as Word document
document.Save("WordMLToWord.docx", FormatType.Docx)
'Closes the document
document.Close()
{% endhighlight %}

{% endtabs %}

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/WordML-conversion/Convert-WordML-to-Word/.NET).