Compatibility enumeration

Compatibility enumeration

Specifies names of compatibility options.

Members

NameDescription
NO_TAB_HANG_INDNo Tab Hang Indent
NO_SPACE_RAISE_LOWERNo Space Raise Lower
SUPPRESS_SP_BF_AFTER_PG_BRKSuppress Space Before Paragraph Break
WRAP_TRAIL_SPACESWrap Trailing Spaces
PRINT_COL_BLACKPrint Column Background
NO_COLUMN_BALANCENo Column Balancing
CONV_MAIL_MERGE_ESCConvert Mail Merge Escapes
SUPPRESS_TOP_SPACINGSuppress Top Spacing
USE_SINGLE_BORDERFOR_CONTIGUOUS_CELLSUse Single Border for Contiguous Cells
TRANSPARENT_METAFILESTransparent Metafiles
SHOW_BREAKS_IN_FRAMESShow Breaks in Frames
SWAP_BORDERS_ODD_FACING_PGSSwap Borders on Odd-Facing Pages
DO_NOT_LEAVE_BACKSLASH_ALONEDo Not Leave Backslash Alone
DO_NOT_EXPAND_ON_SHIFT_RETURNDo Not Expand on Shift Return
UL_TRAIL_SPACEUnderline Trailing Space
BALANCE_SINGLE_BYTE_DOUBLE_BYTE_WIDTHBalance Single-Byte and Double-Byte Widths
SUPPRESS_TOP_SPACING_AT_TOP_OF_PAGESuppress Top Line Spacing in WordPerfect
SPACING_IN_WHOLE_POINTSSpacing in Whole Points
PRINT_BODY_TEXT_BEFORE_HEADERPrint Body Text Before Header
NO_LEADINGNo Leading
SPACE_FOR_ULSpace for Underline
MW_SMALL_CAPSMW Small Caps
SUPPRESS_TOP_LINE_SPACING_WPSuppress Top Line Spacing in WordPerfect
TRUNCATE_FONT_HEIGHT_LIKE_WP6Truncate Font Height Like WordPerfect 6
SUB_FONT_BY_SIZESubstitute Font by Size
LINE_WRAP_LIKE_WORD6Line Wrap Like Word 6
DO_NOT_SUPPRESS_PARAGRAPH_BORDERDo Not Suppress Paragraph Border
NO_EXTRA_LINE_SPACINGNo Extra Line Spacing
SUPPRESS_BOTTOM_SPACINGSuppress Bottom Spacing
WP_SPACE_WIDTHWordPerfect Space Width
WP_JUSTIFICATIONWordPerfect Justification
USE_PRINTER_METRICSUse Printer Metrics
SHAPE_LAYOUT_LIKE_WW8Shape Layout Like Word 2000
FOOTNOTE_LAYOUT_LIKE_WW8Footnote Layout Like Word 2000
DO_NOT_USE_HTML_PARAGRAPH_AUTO_SPACINGDo Not Use HTML Paragraph Auto Spacing
ADJUST_LINE_HEIGHT_IN_TABLEAdjust Line Height in Table
FORGET_LAST_TAB_ALIGNMENTForget Last Tab Alignment
AUTO_SPACE_LIKE_WORD95Auto Space Like Word 95
ALIGN_TABLE_ROW_BY_ROWAlign Table Rows by Rule
LAYOUT_RAW_TABLE_WIDTHLayout Raw Table Width
LAYOUT_TABLE_ROWS_APARTLayout Table Rows Apart
USE_WORD97_LINE_BREAK_RULESUse Word 97 Line Break Rules
DO_NOT_BREAK_WRAPPED_TABLESDo Not Break Wrapped Tables
DO_NOT_SNAP_TO_GRID_IN_CELLDo Not Snap to Grid in Cells
SELECT_FLD_WITH_FIRST_OR_LAST_CHARSelect Field with First or Last Character
APPLY_BREAKING_RULESApply Breaking Rules
DO_NOT_WRAP_TEXT_WITH_PUNCTDo Not Wrap Text with Punctuation
DO_NOT_USE_EAST_ASIAN_BREAK_RULESDo Not Use East Asian Break Rules
USE_WORD2002_TABLE_STYLE_RULESUse Word 2002 Table Style Rules
GROW_AUTOFITGrow AutoFit
USE_NORMAL_STYLE_FOR_LISTUse Normal Style for List
DO_NOT_USE_INDENT_AS_NUMBERING_TAB_STOPDo Not Use Indent as Numbering Tab Stop
USE_ALT_KINSOKU_LINE_BREAK_RULESUse Alt Kinsoku Line Break Rules
ALLOW_SPACE_OF_SAME_STYLE_IN_TABLEAllow Space of Same Style in Table
DO_NOT_SUPPRESS_INDENTATIONDo Not Suppress Indentation
DO_NOT_AUTOFIT_CONSTRAINED_TABLESDo Not AutoFit Constrained Tables
AUTOFIT_TO_FIRST_FIXED_WIDTH_CELLAutoFit to First Fixed-Width Cell
UNDERLINE_TAB_IN_NUM_LISTUnderline Tab in Numbered List
DISPLAY_HANGUL_FIXED_WIDTHDisplay Hangul Fixed Width
SPLIT_PG_BREAK_AND_PARA_MARKSplit Page Break and Paragraph Mark
DO_NOT_VERT_ALIGN_CELL_WITH_SPDo Not Vertically Align Cell with Spacing
DO_NOT_BREAK_CONSTRAINED_FORCED_TABLEDo Not Break Constrained Forced Tables
DO_NOT_VERT_ALIGN_IN_TXBXDo Not Vertically Align in Textboxes
USE_ANSI_KERNING_PAIRSUse ANSI Kerning Pairs
CACHED_COL_BALANCECached Column Balancing
USE_FE_LAYOUTUse Far East Layout
UI_COMPAT_97_TO_2003User Interface Compatibility Mode from Word 97 to Word 2003
OVERRIDE_TABLE_STYLE_FONT_SIZE_AND_JUSTIFICATIONOverride Table Style Font Size and Justification
DISABLE_OPEN_TYPE_FONT_FORMATTING_FEATURESDisable OpenType Font Formatting Features
SWAP_INSIDE_AND_OUTSIDE_FOR_MIRROR_INDENTS_AND_RELATIVE_POSITIONINGSwap Inside and Outside for Mirror Indents and Relative Positioning
USE_WORD2010_TABLE_STYLE_RULESUse Word 2010 Table Style Rules

Examples

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

def test_optimize_for(self):

    doc = aw.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.
    options = doc.compatibility_options

    # Print the default settings for a blank document.
    print("\nDefault optimization settings:")
    ExCompatibilityOptions.print_compatibility_options(options)

    # We can access these settings in Microsoft Word via "File" -> "Options" -> "Advanced" -> "Compatibility options for...".
    doc.save(ARTIFACTS_DIR + "CompatibilityOptions.optimize_for.default_settings.docx")

    # We can use the OptimizeFor method to ensure optimal compatibility with a specific Microsoft Word version.
    doc.compatibility_options.optimize_for(aw.settings.MsWordVersion.WORD2010)
    print("\nOptimized for Word 2010:")
    ExCompatibilityOptions.print_compatibility_options(options)

    doc.compatibility_options.optimize_for(aw.settings.MsWordVersion.WORD2000)
    print("\nOptimized for Word 2000:")
    ExCompatibilityOptions.print_compatibility_options(options)

@staticmethod
def print_compatibility_options(options: aw.settings.CompatibilityOptions):
    """Groups all flags in a document's compatibility options object by state, then prints each group."""

    for enabled in (True, False):
        print("\tEnabled options:" if enabled else "\tDisabled options:")
        for opt in dir(options):
            if not opt.startswith('__') and not callable(getattr(options, opt)) and getattr(options, opt) == enabled:
                print(f"\t\t{opt}")

See Also