com.aspose.words

Class LayoutOptions

  • java.lang.Object
    • com.aspose.words.LayoutOptions
  • All Implemented Interfaces:
    java.lang.Cloneable
    public class LayoutOptions 
    extends java.lang.Object

Holds the options that allow controlling the document layout process.

You do not create instances of this class directly. Use the Document.LayoutOptions property to access layout options for this document.

Note that after changing any of the options present in this class, Document.updatePageLayout() method should be called in order for the changed options to be applied to the layout.

Example:

Shows how to set a document's layout options.
Document doc = new Document();

Assert.assertFalse(doc.getLayoutOptions().getShowHiddenText());
Assert.assertFalse(doc.getLayoutOptions().getShowParagraphMarks());

// The appearance of revisions can be controlled from the layout options property
doc.startTrackRevisions("John Doe", new Date());
doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false);

DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln(
        "This is a revision. Normally the text is red with a bar to the left, but we made some changes to the revision options.");

doc.stopTrackRevisions();

// Layout options can be used to show hidden text too
builder.writeln("This text is not hidden.");
builder.getFont().setHidden(true);
builder.writeln(
        "This text is hidden. It will only show up in the output if we allow it to via doc.LayoutOptions.");

doc.getLayoutOptions().setShowHiddenText(true);

doc.save(getArtifactsDir() + "Document.LayoutOptions.pdf");

Property Getters/Setters Summary
RevisionOptionsgetRevisionOptions()
Gets revision options.
booleangetShowComments()
void
setShowComments(booleanvalue)
           Gets or sets indication of whether comments are rendered. Default is True.
booleangetShowHiddenText()
void
setShowHiddenText(booleanvalue)
           Gets or sets indication of whether hidden text in the document is rendered. Default is False.
booleangetShowParagraphMarks()
void
setShowParagraphMarks(booleanvalue)
           Gets or sets indication of whether paragraph marks are rendered. Default is False.
 

    • Property Getters/Setters Detail

      • getRevisionOptions

        public RevisionOptions getRevisionOptions()
        
        Gets revision options.

        Example:

        Shows how to set a document's layout options.
        Document doc = new Document();
        
        Assert.assertFalse(doc.getLayoutOptions().getShowHiddenText());
        Assert.assertFalse(doc.getLayoutOptions().getShowParagraphMarks());
        
        // The appearance of revisions can be controlled from the layout options property
        doc.startTrackRevisions("John Doe", new Date());
        doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
        doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false);
        
        DocumentBuilder builder = new DocumentBuilder(doc);
        builder.writeln(
                "This is a revision. Normally the text is red with a bar to the left, but we made some changes to the revision options.");
        
        doc.stopTrackRevisions();
        
        // Layout options can be used to show hidden text too
        builder.writeln("This text is not hidden.");
        builder.getFont().setHidden(true);
        builder.writeln(
                "This text is hidden. It will only show up in the output if we allow it to via doc.LayoutOptions.");
        
        doc.getLayoutOptions().setShowHiddenText(true);
        
        doc.save(getArtifactsDir() + "Document.LayoutOptions.pdf");
      • getShowComments/setShowComments

        public boolean getShowComments() / public void setShowComments(boolean value)
        
        Gets or sets indication of whether comments are rendered. Default is True.

        Example:

        Shows how to show or hide comments in PDF document.
        Document doc = new Document(getMyDir() + "Comment.Document.docx");
        
        doc.getLayoutOptions().setShowComments(false);
        
        doc.save(getArtifactsDir() + "Document.DoNotShowComments.pdf");
      • getShowHiddenText/setShowHiddenText

        public boolean getShowHiddenText() / public void setShowHiddenText(boolean value)
        
        Gets or sets indication of whether hidden text in the document is rendered. Default is False. This property affects all hidden content, not just text.

        Example:

        Shows how to set a document's layout options.
        Document doc = new Document();
        
        Assert.assertFalse(doc.getLayoutOptions().getShowHiddenText());
        Assert.assertFalse(doc.getLayoutOptions().getShowParagraphMarks());
        
        // The appearance of revisions can be controlled from the layout options property
        doc.startTrackRevisions("John Doe", new Date());
        doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
        doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false);
        
        DocumentBuilder builder = new DocumentBuilder(doc);
        builder.writeln(
                "This is a revision. Normally the text is red with a bar to the left, but we made some changes to the revision options.");
        
        doc.stopTrackRevisions();
        
        // Layout options can be used to show hidden text too
        builder.writeln("This text is not hidden.");
        builder.getFont().setHidden(true);
        builder.writeln(
                "This text is hidden. It will only show up in the output if we allow it to via doc.LayoutOptions.");
        
        doc.getLayoutOptions().setShowHiddenText(true);
        
        doc.save(getArtifactsDir() + "Document.LayoutOptions.pdf");
      • getShowParagraphMarks/setShowParagraphMarks

        public boolean getShowParagraphMarks() / public void setShowParagraphMarks(boolean value)
        
        Gets or sets indication of whether paragraph marks are rendered. Default is False.

        Example:

        Shows how to set a document's layout options.
        Document doc = new Document();
        
        Assert.assertFalse(doc.getLayoutOptions().getShowHiddenText());
        Assert.assertFalse(doc.getLayoutOptions().getShowParagraphMarks());
        
        // The appearance of revisions can be controlled from the layout options property
        doc.startTrackRevisions("John Doe", new Date());
        doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
        doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false);
        
        DocumentBuilder builder = new DocumentBuilder(doc);
        builder.writeln(
                "This is a revision. Normally the text is red with a bar to the left, but we made some changes to the revision options.");
        
        doc.stopTrackRevisions();
        
        // Layout options can be used to show hidden text too
        builder.writeln("This text is not hidden.");
        builder.getFont().setHidden(true);
        builder.writeln(
                "This text is hidden. It will only show up in the output if we allow it to via doc.LayoutOptions.");
        
        doc.getLayoutOptions().setShowHiddenText(true);
        
        doc.save(getArtifactsDir() + "Document.LayoutOptions.pdf");