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();
LayoutOptions options = doc.getLayoutOptions();

// The appearance of revisions can be controlled from the layout options property
doc.startTrackRevisions("John Doe", new Date());
options.getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
options.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.");

options.setShowHiddenText(true);

// This option is equivalent to enabling paragraph marks in Microsoft Word via Home > paragraph > Show Paragraph Marks,
// and can be used to display these features in a .pdf
options.setShowParagraphMarks(true);

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

Constructor Summary
LayoutOptions()
          
 
Property Getters/Setters Summary
IPageLayoutCallbackgetCallback()
voidsetCallback(IPageLayoutCallback value)
           Gets or sets IPageLayoutCallback implementation used by page layout model.
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.
ITextShaperFactorygetTextShaperFactory()
voidsetTextShaperFactory(ITextShaperFactory value)
           Gets or sets ITextShaperFactory implementation used for Advanced Typography rendering features.
 

Constructor Detail

LayoutOptions

public LayoutOptions()

Property Getters/Setters Detail

getCallback/setCallback

public IPageLayoutCallback getCallback() / public void setCallback(IPageLayoutCallback value)
Gets or sets IPageLayoutCallback implementation used by page layout model.

getRevisionOptions

public RevisionOptions getRevisionOptions()
Gets revision options.

Example:

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

// The appearance of revisions can be controlled from the layout options property
doc.startTrackRevisions("John Doe", new Date());
options.getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
options.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.");

options.setShowHiddenText(true);

// This option is equivalent to enabling paragraph marks in Microsoft Word via Home > paragraph > Show Paragraph Marks,
// and can be used to display these features in a .pdf
options.setShowParagraphMarks(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() + "Comments.docx");
doc.getLayoutOptions().setShowComments(false);

doc.save(getArtifactsDir() + "Document.HideComments.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();
LayoutOptions options = doc.getLayoutOptions();

// The appearance of revisions can be controlled from the layout options property
doc.startTrackRevisions("John Doe", new Date());
options.getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
options.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.");

options.setShowHiddenText(true);

// This option is equivalent to enabling paragraph marks in Microsoft Word via Home > paragraph > Show Paragraph Marks,
// and can be used to display these features in a .pdf
options.setShowParagraphMarks(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();
LayoutOptions options = doc.getLayoutOptions();

// The appearance of revisions can be controlled from the layout options property
doc.startTrackRevisions("John Doe", new Date());
options.getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
options.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.");

options.setShowHiddenText(true);

// This option is equivalent to enabling paragraph marks in Microsoft Word via Home > paragraph > Show Paragraph Marks,
// and can be used to display these features in a .pdf
options.setShowParagraphMarks(true);

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

getTextShaperFactory/setTextShaperFactory

public ITextShaperFactory getTextShaperFactory() / public void setTextShaperFactory(ITextShaperFactory value)
Gets or sets 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 text shaping.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.