Aspose::Words::Layout::LayoutOptions class

LayoutOptions class

Holds the options that allow controlling the document layout process. To learn more, visit the Converting to Fixed-page Format documentation article.

class LayoutOptions : public System::Object

Methods

MethodDescription
get_Callback() constGets IPageLayoutCallback implementation used by page layout model.
get_CommentDisplayMode() constGets or sets the way comments are rendered. Default value is ShowInBalloons.
get_ContinuousSectionPageNumberingRestart() constGets or sets the mode of behavior for computing page numbers when a continuous section restarts the page numbering.
get_IgnorePrinterMetrics() constGets or sets indication of whether the “Use printer metrics to lay out document” compatibility option is ignored. Default is true.
get_KeepOriginalFontMetrics() constGets an indication of whether the original font metrics should be used after font substitution. Default is true.
get_RevisionOptions() constGets revision options.
get_ShowHiddenText() constGets or sets indication of whether hidden text in the document is rendered. Default is false.
get_ShowParagraphMarks() constGets or sets indication of whether paragraph marks are rendered. Default is false.
get_TextShaperFactory() constGets ITextShaperFactory implementation used for Advanced Typography rendering features.
GetType() const override
Is(const System::TypeInfo&) const override
LayoutOptions()
set_Callback(const System::SharedPtr<Aspose::Words::Layout::IPageLayoutCallback>&)Sets IPageLayoutCallback implementation used by page layout model.
set_CommentDisplayMode(Aspose::Words::Layout::CommentDisplayMode)Setter for Aspose::Words::Layout::LayoutOptions::get_CommentDisplayMode.
set_ContinuousSectionPageNumberingRestart(Aspose::Words::Layout::ContinuousSectionRestart)Setter for Aspose::Words::Layout::LayoutOptions::get_ContinuousSectionPageNumberingRestart.
set_IgnorePrinterMetrics(bool)Setter for Aspose::Words::Layout::LayoutOptions::get_IgnorePrinterMetrics.
set_KeepOriginalFontMetrics(bool)Sets an indication of whether the original font metrics should be used after font substitution. Default is true.
set_ShowHiddenText(bool)Setter for Aspose::Words::Layout::LayoutOptions::get_ShowHiddenText.
set_ShowParagraphMarks(bool)Setter for Aspose::Words::Layout::LayoutOptions::get_ShowParagraphMarks.
set_TextShaperFactory(const System::SharedPtr<Aspose::Words::Shaping::ITextShaperFactory>&)Sets ITextShaperFactory implementation used for Advanced Typography rendering features.
static Type()

Remarks

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

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

Examples

Shows how to alter the appearance of revisions in a rendered output document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

// Insert a revision, then change the color of all revisions to green.
builder->Writeln(u"This is not a revision.");
doc->StartTrackRevisions(u"John Doe", System::DateTime::get_Now());
builder->Writeln(u"This is a revision.");
doc->StopTrackRevisions();
builder->Writeln(u"This is not a revision.");

// Remove the bar that appears to the left of every revised line.
doc->get_LayoutOptions()->get_RevisionOptions()->set_InsertedTextColor(RevisionColor::BrightGreen);
doc->get_LayoutOptions()->get_RevisionOptions()->set_ShowRevisionBars(false);

doc->Save(ArtifactsDir + u"Document.LayoutOptionsRevisions.pdf");

Shows how to hide text in a rendered output document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

// Insert hidden text, then specify whether we wish to omit it from a rendered document.
builder->Writeln(u"This text is not hidden.");
builder->get_Font()->set_Hidden(true);
builder->Writeln(u"This text is hidden.");

doc->get_LayoutOptions()->set_ShowHiddenText(showHiddenText);

doc->Save(ArtifactsDir + u"Document.LayoutOptionsHiddenText.pdf");

Shows how to show paragraph marks in a rendered output document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<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(u"Hello world!");
builder->Writeln(u"Hello again!");

doc->get_LayoutOptions()->set_ShowParagraphMarks(showParagraphMarks);

doc->Save(ArtifactsDir + u"Document.LayoutOptionsParagraphMarks.pdf");

See Also