public class LayoutOptions
You do not create instances of this class directly. Use the
Note that after changing any of the options present in this class,
Example:
Shows how to hide text in a rendered output document.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert hidden text, then specify whether we wish to omit it from a rendered document. builder.writeln("This text is not hidden."); builder.getFont().setHidden(true); builder.writeln("This text is hidden."); doc.getLayoutOptions().setShowHiddenText(showHiddenText); doc.save(getArtifactsDir() + "Document.LayoutOptionsHiddenText.pdf");
Example:
Shows how to show paragraph marks in a rendered output document.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Add some paragraphs, then enable paragraph marks to show the ends of paragraphs // with a pilcrow (¶) symbol when we render the document. builder.writeln("Hello world!"); builder.writeln("Hello again!"); doc.getLayoutOptions().setShowParagraphMarks(showParagraphMarks); doc.save(getArtifactsDir() + "Document.LayoutOptionsParagraphMarks.pdf");
Example:
Shows how to alter the appearance of revisions in a rendered output document.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a revision, then change the color of all revisions to green. builder.writeln("This is not a revision."); doc.startTrackRevisions("John Doe", new Date()); builder.writeln("This is a revision."); doc.stopTrackRevisions(); builder.writeln("This is not a revision."); // Remove the bar that appears to the left of every revised line. doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN); doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false); doc.save(getArtifactsDir() + "Document.LayoutOptionsRevisions.pdf");
Constructor Summary |
---|
Property Getters/Setters Summary | ||
---|---|---|
IPageLayoutCallback | getCallback() | |
void | setCallback(IPageLayoutCallback value) | |
Gets or sets |
||
int | getCommentDisplayMode() | |
void | setCommentDisplayMode(intvalue) | |
Gets or sets the way comments are rendered.
Default value is |
||
int | getContinuousSectionPageNumberingRestart() | |
void | setContinuousSectionPageNumberingRestart(intvalue) | |
Gets or sets the mode of behavior for computing page numbers when a continuous section restarts the page numbering. The value of the property is ContinuousSectionRestart integer constant. | ||
boolean | getIgnorePrinterMetrics() | |
void | setIgnorePrinterMetrics(booleanvalue) | |
Gets or sets indication of whether the "Use printer metrics to lay out document" compatibility option is ignored. Default is True. | ||
RevisionOptions | getRevisionOptions() | |
Gets revision options.
|
||
boolean | getShowHiddenText() | |
void | setShowHiddenText(booleanvalue) | |
Gets or sets indication of whether hidden text in the document is rendered. Default is False. | ||
boolean | getShowParagraphMarks() | |
void | setShowParagraphMarks(booleanvalue) | |
Gets or sets indication of whether paragraph marks are rendered. Default is False. | ||
ITextShaperFactory | getTextShaperFactory() | |
void | ||
Gets or sets |
public IPageLayoutCallback getCallback() / public void setCallback(IPageLayoutCallback value)
public int getCommentDisplayMode() / public void setCommentDisplayMode(int value)
Example:
Shows how to show comments when saving a document to a rendered format.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.write("Hello world!"); Comment comment = new Comment(doc, "John Doe", "J.D.", new Date()); comment.setText("My comment."); builder.getCurrentParagraph().appendChild(comment); // ShowInAnnotations is only available in Pdf1.7 and Pdf1.5 formats. // In other formats, it will work similarly to Hide. doc.getLayoutOptions().setCommentDisplayMode(CommentDisplayMode.SHOW_IN_ANNOTATIONS); doc.save(getArtifactsDir() + "Document.ShowCommentsInAnnotations.pdf"); // Note that it's required to rebuild the document page layout (via Document.UpdatePageLayout() method) // after changing the Document.LayoutOptions values. doc.getLayoutOptions().setCommentDisplayMode(CommentDisplayMode.SHOW_IN_BALLOONS); doc.updatePageLayout(); doc.save(getArtifactsDir() + "Document.ShowCommentsInBalloons.pdf");
public int getContinuousSectionPageNumberingRestart() / public void setContinuousSectionPageNumberingRestart(int value)
Example:
Shows how to control page numbering in a continuous section.Document doc = new Document(getMyDir() + "Continuous section page numbering.docx"); // By default Aspose.Words behavior matches the Microsoft Word 2019. // If you need old Aspose.Words behavior, repetitive Microsoft Word 2016, use 'ContinuousSectionRestart.FromNewPageOnly'. // Page numbering restarts only if there is no other content before the section on the page where the section starts, // because of that the numbering will reset to 2 from the second page. doc.getLayoutOptions().setContinuousSectionPageNumberingRestart(ContinuousSectionRestart.FROM_NEW_PAGE_ONLY); doc.updatePageLayout(); doc.save(getArtifactsDir() + "Layout.RestartPageNumberingInContinuousSection.pdf");
public boolean getIgnorePrinterMetrics() / public void setIgnorePrinterMetrics(boolean value)
Example:
Shows how to ignore 'Use printer metrics to lay out document' option.Document doc = new Document(getMyDir() + "Rendering.docx"); doc.getLayoutOptions().setIgnorePrinterMetrics(false); doc.save(getArtifactsDir() + "Document.IgnorePrinterMetrics.docx");
public RevisionOptions getRevisionOptions()
Example:
Shows how to alter the appearance of revisions in a rendered output document.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a revision, then change the color of all revisions to green. builder.writeln("This is not a revision."); doc.startTrackRevisions("John Doe", new Date()); builder.writeln("This is a revision."); doc.stopTrackRevisions(); builder.writeln("This is not a revision."); // Remove the bar that appears to the left of every revised line. doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN); doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false); doc.save(getArtifactsDir() + "Document.LayoutOptionsRevisions.pdf");
public boolean getShowHiddenText() / public void setShowHiddenText(boolean value)
Example:
Shows how to hide text in a rendered output document.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert hidden text, then specify whether we wish to omit it from a rendered document. builder.writeln("This text is not hidden."); builder.getFont().setHidden(true); builder.writeln("This text is hidden."); doc.getLayoutOptions().setShowHiddenText(showHiddenText); doc.save(getArtifactsDir() + "Document.LayoutOptionsHiddenText.pdf");
public boolean getShowParagraphMarks() / public void setShowParagraphMarks(boolean value)
Example:
Shows how to show paragraph marks in a rendered output document.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Add some paragraphs, then enable paragraph marks to show the ends of paragraphs // with a pilcrow (¶) symbol when we render the document. builder.writeln("Hello world!"); builder.writeln("Hello again!"); doc.getLayoutOptions().setShowParagraphMarks(showParagraphMarks); doc.save(getArtifactsDir() + "Document.LayoutOptionsParagraphMarks.pdf");
public ITextShaperFactory getTextShaperFactory() / public void setTextShaperFactory(ITextShaperFactory value)
Example:
Shows how to support OpenType features using the HarfBuzz text shaping engine.Document doc = new Document(getMyDir() + "OpenType text shaping.docx"); // Aspose.Words can use externally provided text shaper objects, // which represent fonts and compute shaping information for text. // A text shaper factory is necessary for documents that use multiple fonts. // When the text shaper factory set, the layout uses OpenType features. // An Instance property returns a static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory. doc.getLayoutOptions().setTextShaperFactory(HarfBuzzTextShaperFactory.getInstance()); // Currently, text shaping is performing when exporting to PDF or XPS formats. doc.save(getArtifactsDir() + "Document.OpenType.pdf");