com.aspose.words

Class Compatibility

  • java.lang.Object
    • com.aspose.words.Compatibility
public class Compatibility 
extends java.lang.Object

Utility class containing constants. Specifies names of compatibility options.

Example:

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

    // By default, the CompatibilityOptions will contain the set of values printed below
    System.out.println("\nDefault optimization settings:");
    printCompatibilityOptions(options);

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

    // We can use the OptimizeFor method to set these values automatically
    // for maximum compatibility with some Microsoft Word versions
    doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2010);
    System.out.println("\nOptimized for Word 2010:");
    printCompatibilityOptions(options);

    doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2000);
    System.out.println("\nOptimized for Word 2000:");
    printCompatibilityOptions(options);
}

/// <summary>
/// Prints all options of a CompatibilityOptions object and indicates whether they are enabled or disabled
/// </summary>
private static void printCompatibilityOptions(CompatibilityOptions options) throws IntrospectionException {
    for (int i = 1; i >= 0; i--) {
        System.out.println((i != 0) ? "\tEnabled options:" : "\tDisabled options:");
        SortedSet<String> optionNames = null;

        BeanInfo infoAboutFoo = Introspector.getBeanInfo(CompatibilityOptions.class);
        PropertyDescriptor[] fooDescriptors = infoAboutFoo.getPropertyDescriptors();

        for (PropertyDescriptor descriptor : fooDescriptors) {
            if (descriptor.getPropertyType().getTypeName() == "boolean" && i == (int) descriptor.getValue(String.valueOf(options))) {
                optionNames.add(descriptor.getName());
            }
        }

        for (String s : optionNames) {
            System.out.println(MessageFormat.format("\t\t{0}", s));
        }
    }
}

Field Summary
static final intNO_TAB_HANG_IND = 0
static final intNO_SPACE_RAISE_LOWER = 1
static final intSUPPRESS_SP_BF_AFTER_PG_BRK = 2
static final intWRAP_TRAIL_SPACES = 3
static final intPRINT_COL_BLACK = 4
static final intNO_COLUMN_BALANCE = 5
static final intCONV_MAIL_MERGE_ESC = 6
static final intSUPPRESS_TOP_SPACING = 7
static final intUSE_SINGLE_BORDERFOR_CONTIGUOUS_CELLS = 8
static final intTRANSPARENT_METAFILES = 9
static final intSHOW_BREAKS_IN_FRAMES = 10
static final intSWAP_BORDERS_ODD_FACING_PGS = 11
static final intDO_NOT_LEAVE_BACKSLASH_ALONE = 12
static final intDO_NOT_EXPAND_ON_SHIFT_RETURN = 13
static final intUL_TRAIL_SPACE = 14
static final intBALANCE_SINGLE_BYTE_DOUBLE_BYTE_WIDTH = 15
static final intSUPPRESS_TOP_SPACING_AT_TOP_OF_PAGE = 16
static final intSPACING_IN_WHOLE_POINTS = 17
static final intPRINT_BODY_TEXT_BEFORE_HEADER = 18
static final intNO_LEADING = 19
static final intSPACE_FOR_UL = 20
static final intMW_SMALL_CAPS = 21
static final intSUPPRESS_TOP_LINE_SPACING_WP = 22
static final intTRUNCATE_FONT_HEIGHT_LIKE_WP_6 = 23
static final intSUB_FONT_BY_SIZE = 24
static final intLINE_WRAP_LIKE_WORD_6 = 25
static final intDO_NOT_SUPPRESS_PARAGRAPH_BORDER = 26
static final intNO_EXTRA_LINE_SPACING = 27
static final intSUPPRESS_BOTTOM_SPACING = 28
static final intWP_SPACE_WIDTH = 29
static final intWP_JUSTIFICATION = 30
static final intUSE_PRINTER_METRICS = 31
static final intSHAPE_LAYOUT_LIKE_WW_8 = 32
static final intFOOTNOTE_LAYOUT_LIKE_WW_8 = 33
static final intDO_NOT_USE_HTML_PARAGRAPH_AUTO_SPACING = 34
static final intADJUST_LINE_HEIGHT_IN_TABLE = 35
static final intFORGET_LAST_TAB_ALIGNMENT = 36
static final intAUTO_SPACE_LIKE_WORD_95 = 37
static final intALIGN_TABLE_ROW_BY_ROW = 38
static final intLAYOUT_RAW_TABLE_WIDTH = 39
static final intLAYOUT_TABLE_ROWS_APART = 40
static final intUSE_WORD_97_LINE_BREAK_RULES = 41
static final intDO_NOT_BREAK_WRAPPED_TABLES = 42
static final intDO_NOT_SNAP_TO_GRID_IN_CELL = 43
static final intSELECT_FLD_WITH_FIRST_OR_LAST_CHAR = 44
static final intAPPLY_BREAKING_RULES = 45
static final intDO_NOT_WRAP_TEXT_WITH_PUNCT = 46
static final intDO_NOT_USE_EAST_ASIAN_BREAK_RULES = 47
static final intUSE_WORD_2002_TABLE_STYLE_RULES = 48
static final intGROW_AUTOFIT = 49
static final intUSE_NORMAL_STYLE_FOR_LIST = 50
static final intDO_NOT_USE_INDENT_AS_NUMBERING_TAB_STOP = 51
static final intUSE_ALT_KINSOKU_LINE_BREAK_RULES = 52
static final intALLOW_SPACE_OF_SAME_STYLE_IN_TABLE = 53
static final intDO_NOT_SUPPRESS_INDENTATION = 54
static final intDO_NOT_AUTOFIT_CONSTRAINED_TABLES = 55
static final intAUTOFIT_TO_FIRST_FIXED_WIDTH_CELL = 56
static final intUNDERLINE_TAB_IN_NUM_LIST = 57
static final intDISPLAY_HANGUL_FIXED_WIDTH = 58
static final intSPLIT_PG_BREAK_AND_PARA_MARK = 59
static final intDO_NOT_VERT_ALIGN_CELL_WITH_SP = 60
static final intDO_NOT_BREAK_CONSTRAINED_FORCED_TABLE = 61
static final intDO_NOT_VERT_ALIGN_IN_TXBX = 62
static final intUSE_ANSI_KERNING_PAIRS = 63
static final intCACHED_COL_BALANCE = 64
static final intUSE_FE_LAYOUT = 65
static final intUI_COMPAT_97_TO_2003 = 66
static final intOVERRIDE_TABLE_STYLE_FONT_SIZE_AND_JUSTIFICATION = 67
static final intDISABLE_OPEN_TYPE_FONT_FORMATTING_FEATURES = 68
static final intSWAP_INSIDE_AND_OUTSIDE_FOR_MIRROR_INDENTS_AND_RELATIVE_POSITIONING = 69
static final intUSE_WORD_2010_TABLE_STYLE_RULES = 70
 

    • Field Detail

      • NO_TAB_HANG_IND = 0

        public static final int NO_TAB_HANG_IND
      • NO_SPACE_RAISE_LOWER = 1

        public static final int NO_SPACE_RAISE_LOWER
      • SUPPRESS_SP_BF_AFTER_PG_BRK = 2

        public static final int SUPPRESS_SP_BF_AFTER_PG_BRK
      • WRAP_TRAIL_SPACES = 3

        public static final int WRAP_TRAIL_SPACES
      • PRINT_COL_BLACK = 4

        public static final int PRINT_COL_BLACK
      • NO_COLUMN_BALANCE = 5

        public static final int NO_COLUMN_BALANCE
      • CONV_MAIL_MERGE_ESC = 6

        public static final int CONV_MAIL_MERGE_ESC
      • SUPPRESS_TOP_SPACING = 7

        public static final int SUPPRESS_TOP_SPACING
      • USE_SINGLE_BORDERFOR_CONTIGUOUS_CELLS = 8

        public static final int USE_SINGLE_BORDERFOR_CONTIGUOUS_CELLS
      • TRANSPARENT_METAFILES = 9

        public static final int TRANSPARENT_METAFILES
      • SHOW_BREAKS_IN_FRAMES = 10

        public static final int SHOW_BREAKS_IN_FRAMES
      • SWAP_BORDERS_ODD_FACING_PGS = 11

        public static final int SWAP_BORDERS_ODD_FACING_PGS
      • DO_NOT_LEAVE_BACKSLASH_ALONE = 12

        public static final int DO_NOT_LEAVE_BACKSLASH_ALONE
      • DO_NOT_EXPAND_ON_SHIFT_RETURN = 13

        public static final int DO_NOT_EXPAND_ON_SHIFT_RETURN
      • UL_TRAIL_SPACE = 14

        public static final int UL_TRAIL_SPACE
      • BALANCE_SINGLE_BYTE_DOUBLE_BYTE_WIDTH = 15

        public static final int BALANCE_SINGLE_BYTE_DOUBLE_BYTE_WIDTH
      • SUPPRESS_TOP_SPACING_AT_TOP_OF_PAGE = 16

        public static final int SUPPRESS_TOP_SPACING_AT_TOP_OF_PAGE
      • SPACING_IN_WHOLE_POINTS = 17

        public static final int SPACING_IN_WHOLE_POINTS
      • PRINT_BODY_TEXT_BEFORE_HEADER = 18

        public static final int PRINT_BODY_TEXT_BEFORE_HEADER
      • NO_LEADING = 19

        public static final int NO_LEADING
      • SPACE_FOR_UL = 20

        public static final int SPACE_FOR_UL
      • MW_SMALL_CAPS = 21

        public static final int MW_SMALL_CAPS
      • SUPPRESS_TOP_LINE_SPACING_WP = 22

        public static final int SUPPRESS_TOP_LINE_SPACING_WP
      • TRUNCATE_FONT_HEIGHT_LIKE_WP_6 = 23

        public static final int TRUNCATE_FONT_HEIGHT_LIKE_WP_6
      • SUB_FONT_BY_SIZE = 24

        public static final int SUB_FONT_BY_SIZE
      • LINE_WRAP_LIKE_WORD_6 = 25

        public static final int LINE_WRAP_LIKE_WORD_6
      • DO_NOT_SUPPRESS_PARAGRAPH_BORDER = 26

        public static final int DO_NOT_SUPPRESS_PARAGRAPH_BORDER
      • NO_EXTRA_LINE_SPACING = 27

        public static final int NO_EXTRA_LINE_SPACING
      • SUPPRESS_BOTTOM_SPACING = 28

        public static final int SUPPRESS_BOTTOM_SPACING
      • WP_SPACE_WIDTH = 29

        public static final int WP_SPACE_WIDTH
      • WP_JUSTIFICATION = 30

        public static final int WP_JUSTIFICATION
      • USE_PRINTER_METRICS = 31

        public static final int USE_PRINTER_METRICS
      • SHAPE_LAYOUT_LIKE_WW_8 = 32

        public static final int SHAPE_LAYOUT_LIKE_WW_8
      • FOOTNOTE_LAYOUT_LIKE_WW_8 = 33

        public static final int FOOTNOTE_LAYOUT_LIKE_WW_8
      • DO_NOT_USE_HTML_PARAGRAPH_AUTO_SPACING = 34

        public static final int DO_NOT_USE_HTML_PARAGRAPH_AUTO_SPACING
      • ADJUST_LINE_HEIGHT_IN_TABLE = 35

        public static final int ADJUST_LINE_HEIGHT_IN_TABLE
      • FORGET_LAST_TAB_ALIGNMENT = 36

        public static final int FORGET_LAST_TAB_ALIGNMENT
      • AUTO_SPACE_LIKE_WORD_95 = 37

        public static final int AUTO_SPACE_LIKE_WORD_95
      • ALIGN_TABLE_ROW_BY_ROW = 38

        public static final int ALIGN_TABLE_ROW_BY_ROW
      • LAYOUT_RAW_TABLE_WIDTH = 39

        public static final int LAYOUT_RAW_TABLE_WIDTH
      • LAYOUT_TABLE_ROWS_APART = 40

        public static final int LAYOUT_TABLE_ROWS_APART
      • USE_WORD_97_LINE_BREAK_RULES = 41

        public static final int USE_WORD_97_LINE_BREAK_RULES
      • DO_NOT_BREAK_WRAPPED_TABLES = 42

        public static final int DO_NOT_BREAK_WRAPPED_TABLES
      • DO_NOT_SNAP_TO_GRID_IN_CELL = 43

        public static final int DO_NOT_SNAP_TO_GRID_IN_CELL
      • SELECT_FLD_WITH_FIRST_OR_LAST_CHAR = 44

        public static final int SELECT_FLD_WITH_FIRST_OR_LAST_CHAR
      • APPLY_BREAKING_RULES = 45

        public static final int APPLY_BREAKING_RULES
      • DO_NOT_WRAP_TEXT_WITH_PUNCT = 46

        public static final int DO_NOT_WRAP_TEXT_WITH_PUNCT
      • DO_NOT_USE_EAST_ASIAN_BREAK_RULES = 47

        public static final int DO_NOT_USE_EAST_ASIAN_BREAK_RULES
      • USE_WORD_2002_TABLE_STYLE_RULES = 48

        public static final int USE_WORD_2002_TABLE_STYLE_RULES
      • GROW_AUTOFIT = 49

        public static final int GROW_AUTOFIT
      • USE_NORMAL_STYLE_FOR_LIST = 50

        public static final int USE_NORMAL_STYLE_FOR_LIST
      • DO_NOT_USE_INDENT_AS_NUMBERING_TAB_STOP = 51

        public static final int DO_NOT_USE_INDENT_AS_NUMBERING_TAB_STOP
      • USE_ALT_KINSOKU_LINE_BREAK_RULES = 52

        public static final int USE_ALT_KINSOKU_LINE_BREAK_RULES
      • ALLOW_SPACE_OF_SAME_STYLE_IN_TABLE = 53

        public static final int ALLOW_SPACE_OF_SAME_STYLE_IN_TABLE
      • DO_NOT_SUPPRESS_INDENTATION = 54

        public static final int DO_NOT_SUPPRESS_INDENTATION
      • DO_NOT_AUTOFIT_CONSTRAINED_TABLES = 55

        public static final int DO_NOT_AUTOFIT_CONSTRAINED_TABLES
      • AUTOFIT_TO_FIRST_FIXED_WIDTH_CELL = 56

        public static final int AUTOFIT_TO_FIRST_FIXED_WIDTH_CELL
      • UNDERLINE_TAB_IN_NUM_LIST = 57

        public static final int UNDERLINE_TAB_IN_NUM_LIST
      • DISPLAY_HANGUL_FIXED_WIDTH = 58

        public static final int DISPLAY_HANGUL_FIXED_WIDTH
      • SPLIT_PG_BREAK_AND_PARA_MARK = 59

        public static final int SPLIT_PG_BREAK_AND_PARA_MARK
      • DO_NOT_VERT_ALIGN_CELL_WITH_SP = 60

        public static final int DO_NOT_VERT_ALIGN_CELL_WITH_SP
      • DO_NOT_BREAK_CONSTRAINED_FORCED_TABLE = 61

        public static final int DO_NOT_BREAK_CONSTRAINED_FORCED_TABLE
      • DO_NOT_VERT_ALIGN_IN_TXBX = 62

        public static final int DO_NOT_VERT_ALIGN_IN_TXBX
      • USE_ANSI_KERNING_PAIRS = 63

        public static final int USE_ANSI_KERNING_PAIRS
      • CACHED_COL_BALANCE = 64

        public static final int CACHED_COL_BALANCE
      • USE_FE_LAYOUT = 65

        public static final int USE_FE_LAYOUT
      • UI_COMPAT_97_TO_2003 = 66

        public static final int UI_COMPAT_97_TO_2003
      • OVERRIDE_TABLE_STYLE_FONT_SIZE_AND_JUSTIFICATION = 67

        public static final int OVERRIDE_TABLE_STYLE_FONT_SIZE_AND_JUSTIFICATION
      • DISABLE_OPEN_TYPE_FONT_FORMATTING_FEATURES = 68

        public static final int DISABLE_OPEN_TYPE_FONT_FORMATTING_FEATURES
      • SWAP_INSIDE_AND_OUTSIDE_FOR_MIRROR_INDENTS_AND_RELATIVE_POSITIONING = 69

        public static final int SWAP_INSIDE_AND_OUTSIDE_FOR_MIRROR_INDENTS_AND_RELATIVE_POSITIONING
      • USE_WORD_2010_TABLE_STYLE_RULES = 70

        public static final int USE_WORD_2010_TABLE_STYLE_RULES