Aspose::Words::PageSetup class

PageSetup class

Represents the page setup properties of a section. To learn more, visit the Working with Sections documentation article.

class PageSetup : public Aspose::Words::IBorderAttrSource

Methods

MethodDescription
ClearFormatting()Resets page setup to default paper size, margins and orientation.
get_Bidi()Specifies that this section contains bidirectional (complex scripts) text.
get_BorderAlwaysInFront()Specifies where the page border is positioned relative to intersecting texts and objects.
get_BorderAppliesTo()Specifies which pages the page border is printed on.
get_BorderDistanceFrom()Gets or sets a value that indicates whether the specified page border is measured from the edge of the page or from the text it surrounds.
get_Borders()Gets a collection of the page borders.
get_BorderSurroundsFooter()Specifies whether the page border includes or excludes the footer.
get_BorderSurroundsHeader()Specifies whether the page border includes or excludes the header.
get_BottomMargin()Returns or sets the distance (in points) between the bottom edge of the page and the bottom boundary of the body text.
get_ChapterPageSeparator()Gets the separator character that appears between the chapter number and the page number.
get_CharactersPerLine()Gets or sets the number of characters per line in the document grid.
get_DifferentFirstPageHeaderFooter()True if a different header or footer is used on the first page.
get_EndnoteOptions()Provides options that control numbering and positioning of endnotes in this section.
get_FirstPageTray()Gets the paper tray (bin) to use for the first page of a section. The value is implementation (printer) specific.
get_FooterDistance()Returns or sets the distance (in points) between the footer and the bottom of the page.
get_FootnoteOptions()Provides options that control numbering and positioning of footnotes in this section.
get_Gutter()Gets or sets the amount of extra space added to the margin for document binding.
get_HeaderDistance()Returns or sets the distance (in points) between the header and the top of the page.
get_HeadingLevelForChapter()Gets or sets the heading level style that is applied to the chapter titles in the document.
get_LayoutMode()Gets or sets the layout mode of this section.
get_LeftMargin()Returns or sets the distance (in points) between the left edge of the page and the left boundary of the body text.
get_LineNumberCountBy()Returns or sets the numeric increment for line numbers.
get_LineNumberDistanceFromText()Gets or sets distance between the right edge of line numbers and the left edge of the document.
get_LineNumberRestartMode()Gets or sets the way line numbering runs that is, whether it starts over at the beginning of a new page or section or runs continuously.
get_LinesPerPage()Gets or sets the number of lines per page in the document grid.
get_LineStartingNumber()Gets or sets the starting line number.
get_Margins()Returns preset Margins of the page.
get_MultiplePages() constFor multiple page documents, gets or sets how a document is printed or rendered so that it can be bound as a booklet.
get_OddAndEvenPagesHeaderFooter() constTrue if the document has different headers and footers for odd-numbered and even-numbered pages.
get_Orientation()Returns or sets the orientation of the page.
get_OtherPagesTray()Gets the paper tray (bin) to be used for all but the first page of a section. The value is implementation (printer) specific.
get_PageHeight()Returns or sets the height of the page in points.
get_PageNumberStyle()Gets or sets the page number format.
get_PageStartingNumber()Gets or sets the starting page number of the section.
get_PageWidth()Returns or sets the width of the page in points.
get_PaperSize()Returns or sets the paper size.
get_RestartPageNumbering()True if page numbering restarts at the beginning of the section.
get_RightMargin()Returns or sets the distance (in points) between the right edge of the page and the right boundary of the body text.
get_RtlGutter()Gets or sets whether Microsoft Word uses gutters for the section based on a right-to-left language or a left-to-right language.
get_SectionStart()Returns or sets the type of section break for the specified object.
get_SheetsPerBooklet() constReturns or sets the number of pages to be included in each booklet.
get_SuppressEndnotes()True if endnotes are printed at the end of the next section that doesn’t suppress endnotes. Suppressed endnotes are printed before the endnotes in that section.
get_TextColumns()Returns a collection that represents the set of text columns.
get_TextOrientation()Allows to specify TextOrientation for the whole page. Default value is Horizontal
get_TopMargin()Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text.
get_VerticalAlignment()Returns or sets the vertical alignment of text on each page in a document or section.
GetType() const override
Is(const System::TypeInfo&) const override
set_Bidi(bool)Setter for Aspose::Words::PageSetup::get_Bidi.
set_BorderAlwaysInFront(bool)Setter for Aspose::Words::PageSetup::get_BorderAlwaysInFront.
set_BorderAppliesTo(Aspose::Words::PageBorderAppliesTo)Setter for Aspose::Words::PageSetup::get_BorderAppliesTo.
set_BorderDistanceFrom(Aspose::Words::PageBorderDistanceFrom)Setter for Aspose::Words::PageSetup::get_BorderDistanceFrom.
set_BorderSurroundsFooter(bool)Setter for Aspose::Words::PageSetup::get_BorderSurroundsFooter.
set_BorderSurroundsHeader(bool)Setter for Aspose::Words::PageSetup::get_BorderSurroundsHeader.
set_BottomMargin(double)Setter for Aspose::Words::PageSetup::get_BottomMargin.
set_ChapterPageSeparator(Aspose::Words::ChapterPageSeparator)Sets the separator character that appears between the chapter number and the page number.
set_CharactersPerLine(int32_t)Setter for Aspose::Words::PageSetup::get_CharactersPerLine.
set_DifferentFirstPageHeaderFooter(bool)Setter for Aspose::Words::PageSetup::get_DifferentFirstPageHeaderFooter.
set_FirstPageTray(int32_t)Sets the paper tray (bin) to use for the first page of a section. The value is implementation (printer) specific.
set_FooterDistance(double)Setter for Aspose::Words::PageSetup::get_FooterDistance.
set_Gutter(double)Setter for Aspose::Words::PageSetup::get_Gutter.
set_HeaderDistance(double)Setter for Aspose::Words::PageSetup::get_HeaderDistance.
set_HeadingLevelForChapter(int32_t)Setter for Aspose::Words::PageSetup::get_HeadingLevelForChapter.
set_LayoutMode(Aspose::Words::SectionLayoutMode)Setter for Aspose::Words::PageSetup::get_LayoutMode.
set_LeftMargin(double)Setter for Aspose::Words::PageSetup::get_LeftMargin.
set_LineNumberCountBy(int32_t)Setter for Aspose::Words::PageSetup::get_LineNumberCountBy.
set_LineNumberDistanceFromText(double)Setter for Aspose::Words::PageSetup::get_LineNumberDistanceFromText.
set_LineNumberRestartMode(Aspose::Words::LineNumberRestartMode)Setter for Aspose::Words::PageSetup::get_LineNumberRestartMode.
set_LinesPerPage(int32_t)Setter for Aspose::Words::PageSetup::get_LinesPerPage.
set_LineStartingNumber(int32_t)Setter for Aspose::Words::PageSetup::get_LineStartingNumber.
set_Margins(Aspose::Words::Margins)Sets preset Margins of the page.
set_MultiplePages(Aspose::Words::Settings::MultiplePagesType)Setter for Aspose::Words::PageSetup::get_MultiplePages.
set_OddAndEvenPagesHeaderFooter(bool)Setter for Aspose::Words::PageSetup::get_OddAndEvenPagesHeaderFooter.
set_Orientation(Aspose::Words::Orientation)Setter for Aspose::Words::PageSetup::get_Orientation.
set_OtherPagesTray(int32_t)Sets the paper tray (bin) to be used for all but the first page of a section. The value is implementation (printer) specific.
set_PageHeight(double)Setter for Aspose::Words::PageSetup::get_PageHeight.
set_PageNumberStyle(Aspose::Words::NumberStyle)Setter for Aspose::Words::PageSetup::get_PageNumberStyle.
set_PageStartingNumber(int32_t)Setter for Aspose::Words::PageSetup::get_PageStartingNumber.
set_PageWidth(double)Setter for Aspose::Words::PageSetup::get_PageWidth.
set_PaperSize(Aspose::Words::PaperSize)Setter for Aspose::Words::PageSetup::get_PaperSize.
set_RestartPageNumbering(bool)Setter for Aspose::Words::PageSetup::get_RestartPageNumbering.
set_RightMargin(double)Setter for Aspose::Words::PageSetup::get_RightMargin.
set_RtlGutter(bool)Setter for Aspose::Words::PageSetup::get_RtlGutter.
set_SectionStart(Aspose::Words::SectionStart)Setter for Aspose::Words::PageSetup::get_SectionStart.
set_SheetsPerBooklet(int32_t)Setter for Aspose::Words::PageSetup::get_SheetsPerBooklet.
set_SuppressEndnotes(bool)Setter for Aspose::Words::PageSetup::get_SuppressEndnotes.
set_TextOrientation(Aspose::Words::TextOrientation)Setter for Aspose::Words::PageSetup::get_TextOrientation.
set_TopMargin(double)Setter for Aspose::Words::PageSetup::get_TopMargin.
set_VerticalAlignment(Aspose::Words::PageVerticalAlignment)Setter for Aspose::Words::PageSetup::get_VerticalAlignment.
static Type()

Remarks

PageSetup object contains all the page setup attributes of a section (left margin, bottom margin, paper size, and so on) as properties.

Examples

Shows how to apply and revert page setup settings to sections in a document.

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

// Modify the page setup properties for the builder's current section and add text.
builder->get_PageSetup()->set_Orientation(Orientation::Landscape);
builder->get_PageSetup()->set_VerticalAlignment(PageVerticalAlignment::Center);
builder->Writeln(u"This is the first section, which landscape oriented with vertically centered text.");

// If we start a new section using a document builder,
// it will inherit the builder's current page setup properties.
builder->InsertBreak(BreakType::SectionBreakNewPage);

ASSERT_EQ(Orientation::Landscape, doc->get_Sections()->idx_get(1)->get_PageSetup()->get_Orientation());
ASSERT_EQ(PageVerticalAlignment::Center, doc->get_Sections()->idx_get(1)->get_PageSetup()->get_VerticalAlignment());

// We can revert its page setup properties to their default values using the "ClearFormatting" method.
builder->get_PageSetup()->ClearFormatting();

ASSERT_EQ(Orientation::Portrait, doc->get_Sections()->idx_get(1)->get_PageSetup()->get_Orientation());
ASSERT_EQ(PageVerticalAlignment::Top, doc->get_Sections()->idx_get(1)->get_PageSetup()->get_VerticalAlignment());

builder->Writeln(u"This is the second section, which is in default Letter paper size, portrait orientation and top alignment.");

doc->Save(ArtifactsDir + u"PageSetup.ClearFormatting.docx");

See Also