com.aspose.words
Class LayoutOptions

java.lang.Object
    extended by 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()
voidsetShowComments(boolean value)
           Gets or sets indication of whether comments are rendered. Default is True.
booleangetShowHiddenText()
voidsetShowHiddenText(boolean value)
           Gets or sets indication of whether hidden text in the document is rendered. Default is False.
booleangetShowParagraphMarks()
voidsetShowParagraphMarks(boolean value)
           Gets or sets indication of whether paragraph marks are rendered. Default is False.
Aspose.Words.Shaping.ITextShaperFactorygetTextShaperFactory()
           Gets or sets Aspose.Words.Shaping.ITextShaperFactory implementation used for Advanced Typography rendering features.
 

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");

getTextShaperFactory

public Aspose.Words.Shaping.ITextShaperFactory getTextShaperFactory()
Gets or sets Aspose.Words.Shaping.ITextShaperFactory implementation used for Advanced Typography rendering features.

Example:

Shows how to support OpenType features using HarfBuzz text shaping engine.
// Open a document
Document doc = new Document(getMyDir() + "OpenType.Document.docx");

// Please note that text shaping is only performed when exporting to PDF or XPS formats now

// Aspose.Words is capable of using text shaper objects provided externally.
// A text shaper represents a font and computes shaping information for a text.
// A document typically refers to multiple fonts thus a text shaper factory is necessary.
// When text shaper factory is set, layout starts to use OpenType features.
// An Instance property returns static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory
doc.getLayoutOptions().setTextShaperFactory(HarfBuzzTextShaperFactory.getInstance());

// Render the document to PDF format
doc.save(getArtifactsDir() + "Document.OpenType.pdf");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.