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 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,
// and also remove the bar that appears to the left of every revised line.
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.");

doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false);

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

Constructor Summary
LayoutOptions()
          
 
Property Getters/Setters Summary
IPageLayoutCallbackgetCallback()
voidsetCallback(IPageLayoutCallback value)
           Gets or sets IPageLayoutCallback implementation used by page layout model.
booleangetIgnorePrinterMetrics()
voidsetIgnorePrinterMetrics(boolean value)
           Gets or sets indication of whether the "Use printer metrics to lay out document" compatibility option is ignored. Default is True.
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.

getIgnorePrinterMetrics/setIgnorePrinterMetrics

public boolean getIgnorePrinterMetrics() / public void setIgnorePrinterMetrics(boolean value)
Gets or sets indication of whether the "Use printer metrics to lay out document" compatibility option is ignored. Default is True.

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

getRevisionOptions

public RevisionOptions getRevisionOptions()
Gets revision options.

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,
// and also remove the bar that appears to the left of every revised line.
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.");

doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.BRIGHT_GREEN);
doc.getLayoutOptions().getRevisionOptions().setShowRevisionBars(false);

doc.save(getArtifactsDir() + "Document.LayoutOptionsRevisions.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/hide 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);

doc.getLayoutOptions().setShowComments(showComments);

doc.save(getArtifactsDir() + "Document.ShowComments.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 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");

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

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

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