MsWordVersion enumeration

Allows Aspose.Wods to mimic MS Word version-specific application behavior.

public enum MsWordVersion


Word20000Optimize Aspose.Words behavior to match MS Word 2000 version.
Word20021Optimize Aspose.Words behavior to match MS Word 2002 version.
Word20032Optimize Aspose.Words behavior to match MS Word 2003 version.
Word20073Optimize Aspose.Words behavior to match MS Word 2007 version.
Word20104Optimize Aspose.Words behavior to match MS Word 2010 version.
Word20135Optimize Aspose.Words behavior to match MS Word 2013 version.
Word20166Optimize Aspose.Words behavior to match MS Word 2016 version.
Word20197Optimize Aspose.Words behavior to match MS Word 2019 version.


Shows how to optimize the document for different versions of Microsoft Word.

public void OptimizeFor()
    Document doc = new Document();

    // This object contains an extensive list of flags unique to each document
    // that allow us to facilitate backward compatibility with older versions of Microsoft Word.
    CompatibilityOptions options = doc.CompatibilityOptions;

    // Print the default settings for a blank document.
    Console.WriteLine("\nDefault optimization settings:");

    // We can access these settings in Microsoft Word via "File" -> "Options" -> "Advanced" -> "Compatibility options for...".
    doc.Save(ArtifactsDir + "CompatibilityOptions.OptimizeFor.DefaultSettings.docx");

    // We can use the OptimizeFor method to ensure optimal compatibility with a specific Microsoft Word version.
    Console.WriteLine("\nOptimized for Word 2010:");

    Console.WriteLine("\nOptimized for Word 2000:");

/// <summary>
/// Groups all flags in a document's compatibility options object by state, then prints each group.
/// </summary>
private static void PrintCompatibilityOptions(CompatibilityOptions options)
    for (int i = 1; i >= 0; i--)
        Console.WriteLine(Convert.ToBoolean(i) ? "\tEnabled options:" : "\tDisabled options:");
        SortedSet<string> optionNames = new SortedSet<string>();

        foreach (System.ComponentModel.PropertyDescriptor descriptor in System.ComponentModel.TypeDescriptor.GetProperties(options))
            if (descriptor.PropertyType == Type.GetType("System.Boolean") && i == Convert.ToInt32(descriptor.GetValue(options)))

        foreach (string s in optionNames)

See Also