Open XML SDK, Word documents and Compatibility Mode

A relatively frequent request we see in the Open XML SDK forum is how to make the [Compatibility Mode] text in the Word title bar disappear.

By default, the Open XML SDK will create a document compatible with Word 2007. When opened in a later version of Office, [Compatibility Mode] appears in the document title bar. The question is, how to make the document a Word 2010 or Word 2013 document.

The key lies in creating a Compatibility element in settings.xml that tells Word this document is a Word 2010 (or 2013) document. The critical nodes in the Word Open XML are:
  <w:compatSetting w:val=”14″
Following is some C# code that generates the necessary settings part, settings content and compat and compatSetting elements for a Word 2010 document. For a Word 2013 document “val” should be set to “15”.

I’ll show the code for VB.NET in my next post, as there are some problems using the Linq approach that works for C#.

private static void AddSettingsToMainDocumentPart(MainDocumentPart part)
    DocumentSettingsPart settingsPart = part.DocumentSettingsPart;
    if (settingsPart==null)
        settingsPart = part.AddNewPart<DocumentSettingsPart>();
        settingsPart.Settings = new Settings(
          new Compatibility( 
            new CompatibilitySetting() { 
               Name = new EnumValue<CompatSettingNameValues>
               Val = new StringValue("14"),
               Uri = new StringValue

2 Responses to “Open XML SDK, Word documents and Compatibility Mode”

  1.   Arno Tolmeijer Says:

    Excellent post, thank you. I’m learning a whole new world of Office application development. Thanks!

Leave a Reply