Preservation of unsupported features in Word files

GemBox.Document supports many Microsoft Word, LibreOffice, and Open Office features, but not all. You can preserve unsupported features when reading a document so that they are not lost when writing to a document of the same format.

The following example shows how to preserve unsupported features like SmartArts and Equations in a Word document from input to output, using C# and VB.NET.

using GemBox.Document;

class Program
{
    static void Main()
    {
        // If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // Load Word document, preservation feature is enabled by default.
        var document = DocumentModel.Load("%#Preservation.docx%");

        // Modify Word document.
        document.Sections[0].Blocks.Insert(0,
            new Paragraph(document, "You can preserve unsupported features when modifying a document!"));

        // Save Word document to an output file of the same format together with
        // preserved information (unsupported features) from the input file.
        document.Save("PreservedOutput.docx");
    }
}
Imports GemBox.Document

Module Program

    Sub Main()

        ' If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        ' Load Word document, preservation feature is enabled by default.
        Dim document = DocumentModel.Load("%#Preservation.docx%")

        ' Modify Word document.
        document.Sections(0).Blocks.Insert(0,
            New Paragraph(document, "You can preserve unsupported features when modifying a document!"))

        ' Save Word document to an output file of the same format together with
        ' preserved information (unsupported features) from the input file.
        document.Save("PreservedOutput.docx")

    End Sub
End Module
Reading and writing Word document with preserved SmartArts and Equations
Screenshot of Word file with preserved SmartArts and Equations

You can read more about GemBox.Document's preservation feature on the Preservation help page.

See also


Next steps

GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API. How about testing it today?

Download Buy