CompatibilityOptions Class

Contains compatibility options (that is, the user preferences entered on the Compatibility tab of the Options dialog in Microsoft Word).

Inheritance Hierarchy


Namespace:  Aspose.Words.Settings
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public class CompatibilityOptions

The CompatibilityOptions type exposes the following members.


Public propertyAdjustLineHeightInTable
Add Document Grid Line Pitch To Lines in Table Cells.
Public propertyAlignTablesRowByRow
Align Table Rows Independently.
Public propertyAllowSpaceOfSameStyleInTable
Allow Contextual Spacing of Paragraphs in Tables.
Public propertyApplyBreakingRules
Use Legacy Ethiopic and Amharic Line Breaking Rules.
Public propertyAutofitToFirstFixedWidthCell
Allow Table Columns To Exceed Preferred Widths of Constituent Cells.
Public propertyAutoSpaceLikeWord95
Emulate Word 95 Full-Width Character Spacing.
Public propertyBalanceSingleByteDoubleByteWidth
Balance Single Byte and Double Byte Characters.
Public propertyCachedColBalance
Use Cached Paragraph Information for Column Balancing.
Public propertyConvMailMergeEsc
Treat Backslash Quotation Delimiter as Two Quotation Marks.
Public propertyDisableOpenTypeFontFormattingFeatures
Public propertyDisplayHangulFixedWidth
Always Use Fixed Width for Hangul Characters.
Public propertyDoNotAutofitConstrainedTables
Do Not AutoFit Tables To Fit Next To Wrapped Objects.
Public propertyDoNotBreakConstrainedForcedTable
Don't Break Table Rows Around Floating Tables.
Public propertyDoNotBreakWrappedTables
Do Not Allow Floating Tables To Break Across Pages.
Public propertyDoNotExpandShiftReturn
Don't Justify Lines Ending in Soft Line Break.
Public propertyDoNotLeaveBackslashAlone
Convert Backslash To Yen Sign When Entered.
Public propertyDoNotSnapToGridInCell
Do Not Snap to Document Grid in Table Cells with Objects.
Public propertyDoNotSuppressIndentation
Do Not Ignore Floating Objects When Calculating Paragraph Indentation.
Public propertyDoNotSuppressParagraphBorders
Do Not Suppress Paragraph Borders Next To Frames.
Public propertyDoNotUseEastAsianBreakRules
Do Not Compress Compressible Characters When Using Document Grid.
Public propertyDoNotUseHTMLParagraphAutoSpacing
Use Fixed Paragraph Spacing for HTML Auto Setting.
Public propertyDoNotUseIndentAsNumberingTabStop
Ignore Hanging Indent When Creating Tab Stop After Numbering.
Public propertyDoNotVertAlignCellWithSp
Don't Vertically Align Cells Containing Floating Objects.
Public propertyDoNotVertAlignInTxbx
Ignore Vertical Alignment in Textboxes.
Public propertyDoNotWrapTextWithPunct
Do Not Allow Hanging Punctuation With Character Grid.
Public propertyFootnoteLayoutLikeWW8
Emulate Word 6.x/95/97 Footnote Placement.
Public propertyForgetLastTabAlignment
Ignore Width of Last Tab Stop When Aligning Paragraph If It Is Not Left Aligned.
Public propertyGrowAutofit
Allow Tables to AutoFit Into Page Margins.
Public propertyLayoutRawTableWidth
Ignore Space Before Table When Deciding If Table Should Wrap Floating Object.
Public propertyLayoutTableRowsApart
Allow Table Rows to Wrap Inline Objects Independently.
Public propertyLineWrapLikeWord6
Emulate Word 6.0 Line Wrapping for East Asian Text.
Public propertyMWSmallCaps
Emulate Word 5.x for the Macintosh Small Caps Formatting.
Public propertyNoColumnBalance
Do Not Balance Text Columns within a Section.
Public propertyNoExtraLineSpacing
Do Not Center Content on Lines With Exact Line Height.
Public propertyNoLeading
Do Not Add Leading Between Lines of Text.
Public propertyNoSpaceRaiseLower
Do Not Increase Line Height for Raised/Lowered Text.
Public propertyNoTabHangInd
Do Not Create Custom Tab Stop for Hanging Indent.
Public propertyOverrideTableStyleFontSizeAndJustification
Specifies how the style hierarchy of the document is evaluated.
Public propertyPrintBodyTextBeforeHeader
Print Body Text before Header/Footer Contents.
Public propertyPrintColBlack
Print Colors as Black And White without Dithering.
Public propertySelectFldWithFirstOrLastChar
Select Field When First or Last Character Is Selected.
Public propertyShapeLayoutLikeWW8
Emulate Word 97 Text Wrapping Around Floating Objects.
Public propertyShowBreaksInFrames
Display Page/Column Breaks Present in Frames.
Public propertySpaceForUL
Add Additional Space Below Baseline For Underlined East Asian Text.
Public propertySpacingInWholePoints
Only Expand/Condense Text By Whole Points.
Public propertySplitPgBreakAndParaMark
Always Move Paragraph Mark to Page after a Page Break.
Public propertySubFontBySize
Increase Priority Of Font Size During Font Substitution.
Public propertySuppressBottomSpacing
Ignore Exact Line Height for Last Line on Page.
Public propertySuppressSpacingAtTopOfPage
Ignore Minimum Line Height for First Line on Page.
Public propertySuppressSpBfAfterPgBrk
Do Not Use Space Before On First Line After a Page Break.
Public propertySuppressTopSpacing
Ignore Minimum and Exact Line Height for First Line on Page.
Public propertySuppressTopSpacingWP
Emulate WordPerfect 5.x Line Spacing.
Public propertySwapBordersFacingPgs
Swap Paragraph Borders on Odd Numbered Pages.
Public propertySwapInsideAndOutsideForMirrorIndentsAndRelativePositioning
Public propertyTransparentMetafiles
Specifies not to blank the area behind metafile pictures.
Public propertyTruncateFontHeightsLikeWP6
Emulate WordPerfect 6.x Font Height Calculation.
Public propertyUICompat97To2003
True to disable UI functionality which is not compatible with Word97-2003. Default value is false.
Public propertyUlTrailSpace
Underline All Trailing Spaces.
Public propertyUnderlineTabInNumList
Underline Following Character Following Numbering.
Public propertyUseAltKinsokuLineBreakRules
Use Alternate Set of East Asian Line Breaking Rules.
Public propertyUseAnsiKerningPairs
Use ANSI Kerning Pairs from Fonts.
Public propertyUseFELayout
Do Not Bypass East Asian/Complex Script Layout Code.
Public propertyUseNormalStyleForList
Do Not Automatically Apply List Paragraph Style To Bulleted/Numbered Text.
Public propertyUsePrinterMetrics
Use Printer Metrics To Display Documents.
Public propertyUseSingleBorderforContiguousCells
Use Simplified Rules For Table Border Conflicts.
Public propertyUseWord2002TableStyleRules
Emulate Word 2002 Table Style Rules.
Public propertyUseWord2010TableStyleRules
Public propertyUseWord97LineBreakRules
Emulate Word 97 East Asian Line Breaking.
Public propertyWPJustification
Emulate WordPerfect 6.x Paragraph Justification.
Public propertyWPSpaceWidth
Specifies whether to set the width of a space as is done in WordPerfect 5.x.
Public propertyWrapTrailSpaces
Line Wrap Trailing Spaces.


Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodCode exampleOptimizeFor

Allows to optimize the document contents as well as default Aspose.Words behavior to a particular versions of MS Word.

Use this method to prevent MS Word from displaying "Compatibility mode" ribbon upon document loading. (Note that you may also need to set the Compliance property to Iso29500_2008_Transitional or higher.)

Public methodToString (Inherited from Object.)


Shows how to optimize document for different word versions.
public void OptimizeFor()
    // Create a blank document and get its CompatibilityOptions object
    Document doc = new Document();
    CompatibilityOptions options = doc.CompatibilityOptions;

    // By default, the CompatibilityOptions will contain the set of values printed below
    Console.WriteLine("\nDefault optimization settings:");

    // These attributes can be accessed in the output document via File > Options > Advanced > Compatibility for...
    doc.Save(ArtifactsDir + "CompatibilityOptions.OptimizeFor.DefaultSettings.docx");

    // We can use the OptimizeFor method to set these values automatically
    // for maximum compatibility with some Microsoft Word versions
    Console.WriteLine("\nOptimized for Word 2010:");

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

/// <summary>
/// Prints all options of a CompatibilityOptions object and indicates whether they are enabled or disabled
/// </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