java.lang.Object
com.aspose.words.CompatibilityOptions
- All Implemented Interfaces:
- java.lang.Cloneable
public class CompatibilityOptions
- extends java.lang.Object
Contains compatibility options (that is, the user preferences entered on the Compatibility
tab of the Options dialog in Microsoft Word).
Example:
Shows how to vertically align the text contents of a text box.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertShape(ShapeType.TEXT_BOX, 200.0, 200.0);
// Set the "VerticalAnchor" property to "TextBoxAnchor.Top" to
// align the text in this text box with the top side of the shape.
// Set the "VerticalAnchor" property to "TextBoxAnchor.Middle" to
// align the text in this text box to the center of the shape.
// Set the "VerticalAnchor" property to "TextBoxAnchor.Bottom" to
// align the text in this text box to the bottom of the shape.
shape.getTextBox().setVerticalAnchor(verticalAnchor);
builder.moveTo(shape.getFirstParagraph());
builder.write("Hello world!");
// The vertical aligning of text inside text boxes is available from Microsoft Word 2007 onwards.
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2007);
doc.save(getArtifactsDir() + "Shape.VerticalAnchor.docx");
Example:
Shows how to set an OOXML compliance specification for a saved document to adhere to.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// If we configure compatibility options to comply with Microsoft Word 2003,
// inserting an image will define its shape using VML.
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2003);
builder.insertImage(getImageDir() + "Transparent background logo.png");
Assert.assertEquals(ShapeMarkupLanguage.VML, ((Shape) doc.getChild(NodeType.SHAPE, 0, true)).getMarkupLanguage());
// The "ISO/IEC 29500:2008" OOXML standard does not support VML shapes.
// If we set the "Compliance" property of the SaveOptions object to "OoxmlCompliance.Iso29500_2008_Strict",
// any document we save while passing this object will have to follow that standard.
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.setCompliance(OoxmlCompliance.ISO_29500_2008_STRICT);
saveOptions.setSaveFormat(SaveFormat.DOCX);
doc.save(getArtifactsDir() + "OoxmlSaveOptions.Iso29500Strict.docx", saveOptions);
// Our saved document defines the shape using DML to adhere to the "ISO/IEC 29500:2008" OOXML standard.
doc = new Document(getArtifactsDir() + "OoxmlSaveOptions.Iso29500Strict.docx");
Assert.assertEquals(ShapeMarkupLanguage.DML, ((Shape) doc.getChild(NodeType.SHAPE, 0, true)).getMarkupLanguage());
- See Also:
- Document, Document.CompatibilityOptions
Property Getters/Setters Detail |
getAdjustLineHeightInTable/setAdjustLineHeightInTable | |
public boolean getAdjustLineHeightInTable() / public void setAdjustLineHeightInTable(boolean value)
|
-
Add Document Grid Line Pitch To Lines in Table Cells.
getAlignTablesRowByRow/setAlignTablesRowByRow | |
public boolean getAlignTablesRowByRow() / public void setAlignTablesRowByRow(boolean value)
|
-
Align Table Rows Independently.
getAllowSpaceOfSameStyleInTable/setAllowSpaceOfSameStyleInTable | |
public boolean getAllowSpaceOfSameStyleInTable() / public void setAllowSpaceOfSameStyleInTable(boolean value)
|
-
Allow Contextual Spacing of Paragraphs in Tables.
getApplyBreakingRules/setApplyBreakingRules | |
public boolean getApplyBreakingRules() / public void setApplyBreakingRules(boolean value)
|
-
Use Legacy Ethiopic and Amharic Line Breaking Rules.
getAutofitToFirstFixedWidthCell/setAutofitToFirstFixedWidthCell | |
public boolean getAutofitToFirstFixedWidthCell() / public void setAutofitToFirstFixedWidthCell(boolean value)
|
-
Allow Table Columns To Exceed Preferred Widths of Constituent Cells.
The option is called "Use Word 2003 table autofit rules" in MS Word 2013 user interface.
It actually affects how the grid is calculated for fixed layout tables, too (for some cases).
getAutoSpaceLikeWord95/setAutoSpaceLikeWord95 | |
public boolean getAutoSpaceLikeWord95() / public void setAutoSpaceLikeWord95(boolean value)
|
-
Emulate Word 95 Full-Width Character Spacing.
getBalanceSingleByteDoubleByteWidth/setBalanceSingleByteDoubleByteWidth | |
public boolean getBalanceSingleByteDoubleByteWidth() / public void setBalanceSingleByteDoubleByteWidth(boolean value)
|
-
Balance Single Byte and Double Byte Characters.
getCachedColBalance/setCachedColBalance | |
public boolean getCachedColBalance() / public void setCachedColBalance(boolean value)
|
-
Use Cached Paragraph Information for Column Balancing.
getConvMailMergeEsc/setConvMailMergeEsc | |
public boolean getConvMailMergeEsc() / public void setConvMailMergeEsc(boolean value)
|
-
Treat Backslash Quotation Delimiter as Two Quotation Marks.
getDisableOpenTypeFontFormattingFeatures/setDisableOpenTypeFontFormattingFeatures | |
public boolean getDisableOpenTypeFontFormattingFeatures() / public void setDisableOpenTypeFontFormattingFeatures(boolean value)
|
-
getDisplayHangulFixedWidth/setDisplayHangulFixedWidth | |
public boolean getDisplayHangulFixedWidth() / public void setDisplayHangulFixedWidth(boolean value)
|
-
Always Use Fixed Width for Hangul Characters.
getDoNotAutofitConstrainedTables/setDoNotAutofitConstrainedTables | |
public boolean getDoNotAutofitConstrainedTables() / public void setDoNotAutofitConstrainedTables(boolean value)
|
-
Do Not AutoFit Tables To Fit Next To Wrapped Objects.
getDoNotBreakConstrainedForcedTable/setDoNotBreakConstrainedForcedTable | |
public boolean getDoNotBreakConstrainedForcedTable() / public void setDoNotBreakConstrainedForcedTable(boolean value)
|
-
Don't Break Table Rows Around Floating Tables.
getDoNotBreakWrappedTables/setDoNotBreakWrappedTables | |
public boolean getDoNotBreakWrappedTables() / public void setDoNotBreakWrappedTables(boolean value)
|
-
Do Not Allow Floating Tables To Break Across Pages.
getDoNotExpandShiftReturn/setDoNotExpandShiftReturn | |
public boolean getDoNotExpandShiftReturn() / public void setDoNotExpandShiftReturn(boolean value)
|
-
Don't Justify Lines Ending in Soft Line Break.
getDoNotLeaveBackslashAlone/setDoNotLeaveBackslashAlone | |
public boolean getDoNotLeaveBackslashAlone() / public void setDoNotLeaveBackslashAlone(boolean value)
|
-
Convert Backslash To Yen Sign When Entered.
getDoNotSnapToGridInCell/setDoNotSnapToGridInCell | |
public boolean getDoNotSnapToGridInCell() / public void setDoNotSnapToGridInCell(boolean value)
|
-
Do Not Snap to Document Grid in Table Cells with Objects.
getDoNotSuppressIndentation/setDoNotSuppressIndentation | |
public boolean getDoNotSuppressIndentation() / public void setDoNotSuppressIndentation(boolean value)
|
-
Do Not Ignore Floating Objects When Calculating Paragraph Indentation.
getDoNotSuppressParagraphBorders/setDoNotSuppressParagraphBorders | |
public boolean getDoNotSuppressParagraphBorders() / public void setDoNotSuppressParagraphBorders(boolean value)
|
-
Do Not Suppress Paragraph Borders Next To Frames.
getDoNotUseEastAsianBreakRules/setDoNotUseEastAsianBreakRules | |
public boolean getDoNotUseEastAsianBreakRules() / public void setDoNotUseEastAsianBreakRules(boolean value)
|
-
Do Not Compress Compressible Characters When Using Document Grid.
getDoNotUseHTMLParagraphAutoSpacing/setDoNotUseHTMLParagraphAutoSpacing | |
public boolean getDoNotUseHTMLParagraphAutoSpacing() / public void setDoNotUseHTMLParagraphAutoSpacing(boolean value)
|
-
Use Fixed Paragraph Spacing for HTML Auto Setting.
getDoNotUseIndentAsNumberingTabStop/setDoNotUseIndentAsNumberingTabStop | |
public boolean getDoNotUseIndentAsNumberingTabStop() / public void setDoNotUseIndentAsNumberingTabStop(boolean value)
|
-
Ignore Hanging Indent When Creating Tab Stop After Numbering.
getDoNotVertAlignCellWithSp/setDoNotVertAlignCellWithSp | |
public boolean getDoNotVertAlignCellWithSp() / public void setDoNotVertAlignCellWithSp(boolean value)
|
-
Don't Vertically Align Cells Containing Floating Objects.
getDoNotVertAlignInTxbx/setDoNotVertAlignInTxbx | |
public boolean getDoNotVertAlignInTxbx() / public void setDoNotVertAlignInTxbx(boolean value)
|
-
Ignore Vertical Alignment in Textboxes.
getDoNotWrapTextWithPunct/setDoNotWrapTextWithPunct | |
public boolean getDoNotWrapTextWithPunct() / public void setDoNotWrapTextWithPunct(boolean value)
|
-
Do Not Allow Hanging Punctuation With Character Grid.
getFootnoteLayoutLikeWW8/setFootnoteLayoutLikeWW8 | |
public boolean getFootnoteLayoutLikeWW8() / public void setFootnoteLayoutLikeWW8(boolean value)
|
-
Emulate Word 6.x/95/97 Footnote Placement.
getForgetLastTabAlignment/setForgetLastTabAlignment | |
public boolean getForgetLastTabAlignment() / public void setForgetLastTabAlignment(boolean value)
|
-
Ignore Width of Last Tab Stop When Aligning Paragraph If It Is Not Left Aligned.
getGrowAutofit/setGrowAutofit | |
public boolean getGrowAutofit() / public void setGrowAutofit(boolean value)
|
-
Allow Tables to AutoFit Into Page Margins.
getLayoutRawTableWidth/setLayoutRawTableWidth | |
public boolean getLayoutRawTableWidth() / public void setLayoutRawTableWidth(boolean value)
|
-
Ignore Space Before Table When Deciding If Table Should Wrap Floating Object.
getLayoutTableRowsApart/setLayoutTableRowsApart | |
public boolean getLayoutTableRowsApart() / public void setLayoutTableRowsApart(boolean value)
|
-
Allow Table Rows to Wrap Inline Objects Independently.
getLineWrapLikeWord6/setLineWrapLikeWord6 | |
public boolean getLineWrapLikeWord6() / public void setLineWrapLikeWord6(boolean value)
|
-
Emulate Word 6.0 Line Wrapping for East Asian Text.
getMWSmallCaps/setMWSmallCaps | |
public boolean getMWSmallCaps() / public void setMWSmallCaps(boolean value)
|
-
Emulate Word 5.x for the Macintosh Small Caps Formatting.
getNoColumnBalance/setNoColumnBalance | |
public boolean getNoColumnBalance() / public void setNoColumnBalance(boolean value)
|
-
Do Not Balance Text Columns within a Section.
getNoExtraLineSpacing/setNoExtraLineSpacing | |
public boolean getNoExtraLineSpacing() / public void setNoExtraLineSpacing(boolean value)
|
-
Do Not Center Content on Lines With Exact Line Height.
getNoLeading/setNoLeading | |
public boolean getNoLeading() / public void setNoLeading(boolean value)
|
-
Do Not Add Leading Between Lines of Text.
getNoSpaceRaiseLower/setNoSpaceRaiseLower | |
public boolean getNoSpaceRaiseLower() / public void setNoSpaceRaiseLower(boolean value)
|
-
Do Not Increase Line Height for Raised/Lowered Text.
getNoTabHangInd/setNoTabHangInd | |
public boolean getNoTabHangInd() / public void setNoTabHangInd(boolean value)
|
-
Do Not Create Custom Tab Stop for Hanging Indent.
getOverrideTableStyleFontSizeAndJustification/setOverrideTableStyleFontSizeAndJustification | |
public boolean getOverrideTableStyleFontSizeAndJustification() / public void setOverrideTableStyleFontSizeAndJustification(boolean value)
|
-
Specifies how the style hierarchy of the document is evaluated.
getPrintBodyTextBeforeHeader/setPrintBodyTextBeforeHeader | |
public boolean getPrintBodyTextBeforeHeader() / public void setPrintBodyTextBeforeHeader(boolean value)
|
-
Print Body Text before Header/Footer Contents.
getPrintColBlack/setPrintColBlack | |
public boolean getPrintColBlack() / public void setPrintColBlack(boolean value)
|
-
Print Colors as Black And White without Dithering.
getSelectFldWithFirstOrLastChar/setSelectFldWithFirstOrLastChar | |
public boolean getSelectFldWithFirstOrLastChar() / public void setSelectFldWithFirstOrLastChar(boolean value)
|
-
Select Field When First or Last Character Is Selected.
getShapeLayoutLikeWW8/setShapeLayoutLikeWW8 | |
public boolean getShapeLayoutLikeWW8() / public void setShapeLayoutLikeWW8(boolean value)
|
-
Emulate Word 97 Text Wrapping Around Floating Objects.
getShowBreaksInFrames/setShowBreaksInFrames | |
public boolean getShowBreaksInFrames() / public void setShowBreaksInFrames(boolean value)
|
-
Display Page/Column Breaks Present in Frames.
getSpaceForUL/setSpaceForUL | |
public boolean getSpaceForUL() / public void setSpaceForUL(boolean value)
|
-
Add Additional Space Below Baseline For Underlined East Asian Text.
getSpacingInWholePoints/setSpacingInWholePoints | |
public boolean getSpacingInWholePoints() / public void setSpacingInWholePoints(boolean value)
|
-
Only Expand/Condense Text By Whole Points.
getSplitPgBreakAndParaMark/setSplitPgBreakAndParaMark | |
public boolean getSplitPgBreakAndParaMark() / public void setSplitPgBreakAndParaMark(boolean value)
|
-
Always Move Paragraph Mark to Page after a Page Break.
getSubFontBySize/setSubFontBySize | |
public boolean getSubFontBySize() / public void setSubFontBySize(boolean value)
|
-
Increase Priority Of Font Size During Font Substitution.
getSuppressBottomSpacing/setSuppressBottomSpacing | |
public boolean getSuppressBottomSpacing() / public void setSuppressBottomSpacing(boolean value)
|
-
Ignore Exact Line Height for Last Line on Page.
getSuppressSpacingAtTopOfPage/setSuppressSpacingAtTopOfPage | |
public boolean getSuppressSpacingAtTopOfPage() / public void setSuppressSpacingAtTopOfPage(boolean value)
|
-
Ignore Minimum Line Height for First Line on Page.
getSuppressSpBfAfterPgBrk/setSuppressSpBfAfterPgBrk | |
public boolean getSuppressSpBfAfterPgBrk() / public void setSuppressSpBfAfterPgBrk(boolean value)
|
-
Do Not Use Space Before On First Line After a Page Break.
getSuppressTopSpacing/setSuppressTopSpacing | |
public boolean getSuppressTopSpacing() / public void setSuppressTopSpacing(boolean value)
|
-
Ignore Minimum and Exact Line Height for First Line on Page.
getSuppressTopSpacingWP/setSuppressTopSpacingWP | |
public boolean getSuppressTopSpacingWP() / public void setSuppressTopSpacingWP(boolean value)
|
-
Emulate WordPerfect 5.x Line Spacing.
getSwapBordersFacingPgs/setSwapBordersFacingPgs | |
public boolean getSwapBordersFacingPgs() / public void setSwapBordersFacingPgs(boolean value)
|
-
Swap Paragraph Borders on Odd Numbered Pages.
getSwapInsideAndOutsideForMirrorIndentsAndRelativePositioning/setSwapInsideAndOutsideForMirrorIndentsAndRelativePositioning | |
public boolean getSwapInsideAndOutsideForMirrorIndentsAndRelativePositioning() / public void setSwapInsideAndOutsideForMirrorIndentsAndRelativePositioning(boolean value)
|
-
getTransparentMetafiles/setTransparentMetafiles | |
public boolean getTransparentMetafiles() / public void setTransparentMetafiles(boolean value)
|
-
Specifies not to blank the area behind metafile pictures.
getTruncateFontHeightsLikeWP6/setTruncateFontHeightsLikeWP6 | |
public boolean getTruncateFontHeightsLikeWP6() / public void setTruncateFontHeightsLikeWP6(boolean value)
|
-
Emulate WordPerfect 6.x Font Height Calculation.
getUICompat97To2003/setUICompat97To2003 | |
public boolean getUICompat97To2003() / public void setUICompat97To2003(boolean value)
|
- True to disable UI functionality which is not compatible with Word97-2003.
Default value is false.
Controls the Word97-2003 compatibility setting that disables UI functionality which
is not compatible with Word97-2003.
When true, 'w:uiCompat97To2003' XML element is written to '\word\settings.xml'
document package part.
Default value is false. When set to false, this element is not written.
Technically this property is not part of compatibility options, but we have put it here for API convenience.
getUlTrailSpace/setUlTrailSpace | |
public boolean getUlTrailSpace() / public void setUlTrailSpace(boolean value)
|
-
Underline All Trailing Spaces.
getUnderlineTabInNumList/setUnderlineTabInNumList | |
public boolean getUnderlineTabInNumList() / public void setUnderlineTabInNumList(boolean value)
|
-
Underline Following Character Following Numbering.
getUseAltKinsokuLineBreakRules/setUseAltKinsokuLineBreakRules | |
public boolean getUseAltKinsokuLineBreakRules() / public void setUseAltKinsokuLineBreakRules(boolean value)
|
-
Use Alternate Set of East Asian Line Breaking Rules.
getUseAnsiKerningPairs/setUseAnsiKerningPairs | |
public boolean getUseAnsiKerningPairs() / public void setUseAnsiKerningPairs(boolean value)
|
-
Use ANSI Kerning Pairs from Fonts.
getUseFELayout/setUseFELayout | |
public boolean getUseFELayout() / public void setUseFELayout(boolean value)
|
-
Do Not Bypass East Asian/Complex Script Layout Code.
getUseNormalStyleForList/setUseNormalStyleForList | |
public boolean getUseNormalStyleForList() / public void setUseNormalStyleForList(boolean value)
|
-
Do Not Automatically Apply List Paragraph Style To Bulleted/Numbered Text.
getUsePrinterMetrics/setUsePrinterMetrics | |
public boolean getUsePrinterMetrics() / public void setUsePrinterMetrics(boolean value)
|
-
Use Printer Metrics To Display Documents.
Printer Metrics may differ depending on drivers used.
For instance, Windows "Microsoft OpenXPS Class Driver 2" and "Microsoft Print to PDF" provide slightly different metrics.
Therefore, the final document's layout may change if this option is enabled.
getUseSingleBorderforContiguousCells/setUseSingleBorderforContiguousCells | |
public boolean getUseSingleBorderforContiguousCells() / public void setUseSingleBorderforContiguousCells(boolean value)
|
-
Use Simplified Rules For Table Border Conflicts.
getUseWord2002TableStyleRules/setUseWord2002TableStyleRules | |
public boolean getUseWord2002TableStyleRules() / public void setUseWord2002TableStyleRules(boolean value)
|
-
Emulate Word 2002 Table Style Rules.
getUseWord2010TableStyleRules/setUseWord2010TableStyleRules | |
public boolean getUseWord2010TableStyleRules() / public void setUseWord2010TableStyleRules(boolean value)
|
-
getUseWord97LineBreakRules/setUseWord97LineBreakRules | |
public boolean getUseWord97LineBreakRules() / public void setUseWord97LineBreakRules(boolean value)
|
-
Emulate Word 97 East Asian Line Breaking.
getWPJustification/setWPJustification | |
public boolean getWPJustification() / public void setWPJustification(boolean value)
|
-
Emulate WordPerfect 6.x Paragraph Justification.
getWPSpaceWidth/setWPSpaceWidth | |
public boolean getWPSpaceWidth() / public void setWPSpaceWidth(boolean value)
|
-
Specifies whether to set the width of a space as is done in WordPerfect 5.x.
getWrapTrailSpaces/setWrapTrailSpaces | |
public boolean getWrapTrailSpaces() / public void setWrapTrailSpaces(boolean value)
|
-
Line Wrap Trailing Spaces.
optimizeFor | |
public void optimizeFor(int version) |
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 OoxmlSaveOptions.Compliance property to
OoxmlCompliance.ISO_29500_2008_TRANSITIONAL or higher.)
- Parameters:
version
- A MsWordVersion value.
Example:
Shows how to set an OOXML compliance specification for a saved document to adhere to.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// If we configure compatibility options to comply with Microsoft Word 2003,
// inserting an image will define its shape using VML.
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2003);
builder.insertImage(getImageDir() + "Transparent background logo.png");
Assert.assertEquals(ShapeMarkupLanguage.VML, ((Shape) doc.getChild(NodeType.SHAPE, 0, true)).getMarkupLanguage());
// The "ISO/IEC 29500:2008" OOXML standard does not support VML shapes.
// If we set the "Compliance" property of the SaveOptions object to "OoxmlCompliance.Iso29500_2008_Strict",
// any document we save while passing this object will have to follow that standard.
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.setCompliance(OoxmlCompliance.ISO_29500_2008_STRICT);
saveOptions.setSaveFormat(SaveFormat.DOCX);
doc.save(getArtifactsDir() + "OoxmlSaveOptions.Iso29500Strict.docx", saveOptions);
// Our saved document defines the shape using DML to adhere to the "ISO/IEC 29500:2008" OOXML standard.
doc = new Document(getArtifactsDir() + "OoxmlSaveOptions.Iso29500Strict.docx");
Assert.assertEquals(ShapeMarkupLanguage.DML, ((Shape) doc.getChild(NodeType.SHAPE, 0, true)).getMarkupLanguage());
Example:
Shows how to vertically align the text contents of a text box.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertShape(ShapeType.TEXT_BOX, 200.0, 200.0);
// Set the "VerticalAnchor" property to "TextBoxAnchor.Top" to
// align the text in this text box with the top side of the shape.
// Set the "VerticalAnchor" property to "TextBoxAnchor.Middle" to
// align the text in this text box to the center of the shape.
// Set the "VerticalAnchor" property to "TextBoxAnchor.Bottom" to
// align the text in this text box to the bottom of the shape.
shape.getTextBox().setVerticalAnchor(verticalAnchor);
builder.moveTo(shape.getFirstParagraph());
builder.write("Hello world!");
// The vertical aligning of text inside text boxes is available from Microsoft Word 2007 onwards.
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2007);
doc.save(getArtifactsDir() + "Shape.VerticalAnchor.docx");
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.