Skip to content
Merged
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
54 changes: 54 additions & 0 deletions File-Formats/DocIO/word-file-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync

### Saving Word document with compatibility

#### Maintain existing compatibility
The following code shows, how to save Word document with same word version compatibility

{% tabs %}
Expand Down Expand Up @@ -738,6 +739,59 @@ document.Close();

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-file-formats/Save-Word-with-compatibility).

#### Save Word in old compatibility

The following code shows, how to save Word document in old compatibility using DocIO.
{% tabs %}

{% highlight c# tabtitle="C# [Cross-platform]" %}

//Create an instance of WordDocument.
using (WordDocument document = new WordDocument())
{
document.EnsureMinimal();
//Append paragraph.
document.LastParagraph.AppendText("Hello World");
//Sets the compatibility mode to Word 2007.
document.Settings.CompatibilityMode = CompatibilityMode.Word2007;
//Create FileStream to save the Word file.
using (FileStream outputStream = new FileStream("Sample.docx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Save the Word file.
document.Save(outputStream, FormatType.Docx);
}
}

{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}

//Create an instance of WordDocument.
using(WordDocument document = new WordDocument())
{
document.EnsureMinimal();
document.LastParagraph.AppendText("Hello World");
//Sets the compatibility mode to Word 2007.
document.Settings.CompatibilityMode = CompatibilityMode.Word2007;
document.Save("Sample.docx");
}

{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}

'Create an instance of WordDocument.
Using document As New WordDocument()
document.EnsureMinimal()
document.LastParagraph.AppendText("Hello World")
' Sets the compatibility mode to Word 2007.
document.Settings.CompatibilityMode = CompatibilityMode.Word2007
document.Save("Sample.docx")
End Using

{% endhighlight %}
{% endtabs %}

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-file-formats/Save-Word-in-old-compatibility/.NET).

### Open a Word (*.doc) document containing incremental save information

Essential DocIO process the content that are preserved in the last complete save operation alone from a Word (.doc) document and it doesn't process the incremental save information. Hence it throws "Complex format is not supported" exception when attempting to open a Word (.doc) document containing incremental save information.
Expand Down