Word.PageSetup class
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Represents the page setup settings for a Word document or section.
- Extends
Remarks
Properties
book |
Specifies whether Microsoft Word prints the document as a booklet. |
book |
Specifies the number of pages for each booklet. |
book |
Specifies if Microsoft Word reverses the printing order for book fold printing of bidirectional or Asian language documents. |
bottom |
Specifies the distance (in points) between the bottom edge of the page and the bottom boundary of the body text. |
chars |
Specifies the number of characters per line in the document grid. |
context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
different |
Specifies whether the first page has a different header and footer. |
footer |
Specifies the distance between the footer and the bottom of the page in points. |
gutter | Specifies the amount (in points) of extra margin space added to each page in a document or section for binding. |
gutter |
Specifies on which side the gutter appears in a document. |
gutter |
Specifies whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language. |
header |
Specifies the distance between the header and the top of the page in points. |
layout |
Specifies the layout mode for the current document. |
left |
Specifies the distance (in points) between the left edge of the page and the left boundary of the body text. |
line |
Specifies a |
lines |
Specifies the number of lines per page in the document grid. |
mirror |
Specifies if the inside and outside margins of facing pages are the same width. |
odd |
Specifies whether odd and even pages have different headers and footers. |
orientation | Specifies the orientation of the page. |
page |
Specifies the page height in points. |
page |
Specifies the page width in points. |
paper |
Specifies the paper size of the page. |
right |
Specifies the distance (in points) between the right edge of the page and the right boundary of the body text. |
section |
Specifies the reading order and alignment for the specified sections. |
section |
Specifies the type of section break for the specified object. |
show |
Specifies whether to show the grid. |
suppress |
Specifies if endnotes are printed at the end of the next section that doesn't suppress endnotes. |
text |
Gets a |
top |
Specifies the top margin of the page in points. |
two |
Specifies whether to print two pages per sheet. |
vertical |
Specifies the vertical alignment of text on each page in a document or section. |
Methods
load(options) | Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
set(properties, options) | Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. |
set(properties) | Sets multiple properties on the object at the same time, based on an existing loaded object. |
set |
Sets the specified page setup formatting as the default for the active document and all new documents based on the active template. |
toggle |
Switches between portrait and landscape page orientations for a document or section. |
toJSON() | Overrides the JavaScript |
track() | Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across |
untrack() | Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call |
Property Details
bookFoldPrinting
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies whether Microsoft Word prints the document as a booklet.
bookFoldPrinting: boolean;
Property Value
boolean
Remarks
bookFoldPrintingSheets
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the number of pages for each booklet.
bookFoldPrintingSheets: number;
Property Value
number
Remarks
bookFoldReversePrinting
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies if Microsoft Word reverses the printing order for book fold printing of bidirectional or Asian language documents.
bookFoldReversePrinting: boolean;
Property Value
boolean
Remarks
bottomMargin
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance (in points) between the bottom edge of the page and the bottom boundary of the body text.
bottomMargin: number;
Property Value
number
Remarks
charsLine
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the number of characters per line in the document grid.
charsLine: number;
Property Value
number
Remarks
context
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The request context associated with the object. This connects the add-in's process to the Office host application's process.
context: RequestContext;
Property Value
differentFirstPageHeaderFooter
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies whether the first page has a different header and footer.
differentFirstPageHeaderFooter: boolean;
Property Value
boolean
Remarks
footerDistance
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance between the footer and the bottom of the page in points.
footerDistance: number;
Property Value
number
Remarks
gutter
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the amount (in points) of extra margin space added to each page in a document or section for binding.
gutter: number;
Property Value
number
Remarks
gutterPosition
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies on which side the gutter appears in a document.
gutterPosition: Word.GutterPosition | "Left" | "Right" | "Top";
Property Value
Word.GutterPosition | "Left" | "Right" | "Top"
Remarks
gutterStyle
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language.
gutterStyle: Word.GutterStyle | "Bidirectional" | "Latin";
Property Value
Word.GutterStyle | "Bidirectional" | "Latin"
Remarks
headerDistance
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance between the header and the top of the page in points.
headerDistance: number;
Property Value
number
Remarks
layoutMode
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the layout mode for the current document.
layoutMode: Word.LayoutMode | "Default" | "Grid" | "LineGrid" | "Genko";
Property Value
Word.LayoutMode | "Default" | "Grid" | "LineGrid" | "Genko"
Remarks
leftMargin
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance (in points) between the left edge of the page and the left boundary of the body text.
leftMargin: number;
Property Value
number
Remarks
lineNumbering
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies a LineNumbering
object that represents the line numbers for the PageSetup
object.
lineNumbering: Word.LineNumbering;
Property Value
Remarks
linesPage
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the number of lines per page in the document grid.
linesPage: number;
Property Value
number
Remarks
mirrorMargins
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies if the inside and outside margins of facing pages are the same width.
mirrorMargins: boolean;
Property Value
boolean
Remarks
oddAndEvenPagesHeaderFooter
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies whether odd and even pages have different headers and footers.
oddAndEvenPagesHeaderFooter: boolean;
Property Value
boolean
Remarks
orientation
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the orientation of the page.
orientation: Word.PageOrientation | "Portrait" | "Landscape";
Property Value
Word.PageOrientation | "Portrait" | "Landscape"
Remarks
pageHeight
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the page height in points.
pageHeight: number;
Property Value
number
Remarks
pageWidth
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the page width in points.
pageWidth: number;
Property Value
number
Remarks
paperSize
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the paper size of the page.
paperSize: Word.PaperSize | "Size10x14" | "Size11x17" | "Letter" | "LetterSmall" | "Legal" | "Executive" | "A3" | "A4" | "A4Small" | "A5" | "B4" | "B5" | "CSheet" | "DSheet" | "ESheet" | "FanfoldLegalGerman" | "FanfoldStdGerman" | "FanfoldUS" | "Folio" | "Ledger" | "Note" | "Quarto" | "Statement" | "Tabloid" | "Envelope9" | "Envelope10" | "Envelope11" | "Envelope12" | "Envelope14" | "EnvelopeB4" | "EnvelopeB5" | "EnvelopeB6" | "EnvelopeC3" | "EnvelopeC4" | "EnvelopeC5" | "EnvelopeC6" | "EnvelopeC65" | "EnvelopeDL" | "EnvelopeItaly" | "EnvelopeMonarch" | "EnvelopePersonal" | "Custom";
Property Value
Word.PaperSize | "Size10x14" | "Size11x17" | "Letter" | "LetterSmall" | "Legal" | "Executive" | "A3" | "A4" | "A4Small" | "A5" | "B4" | "B5" | "CSheet" | "DSheet" | "ESheet" | "FanfoldLegalGerman" | "FanfoldStdGerman" | "FanfoldUS" | "Folio" | "Ledger" | "Note" | "Quarto" | "Statement" | "Tabloid" | "Envelope9" | "Envelope10" | "Envelope11" | "Envelope12" | "Envelope14" | "EnvelopeB4" | "EnvelopeB5" | "EnvelopeB6" | "EnvelopeC3" | "EnvelopeC4" | "EnvelopeC5" | "EnvelopeC6" | "EnvelopeC65" | "EnvelopeDL" | "EnvelopeItaly" | "EnvelopeMonarch" | "EnvelopePersonal" | "Custom"
Remarks
rightMargin
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance (in points) between the right edge of the page and the right boundary of the body text.
rightMargin: number;
Property Value
number
Remarks
sectionDirection
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the reading order and alignment for the specified sections.
sectionDirection: Word.SectionDirection | "RightToLeft" | "LeftToRight";
Property Value
Word.SectionDirection | "RightToLeft" | "LeftToRight"
Remarks
sectionStart
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the type of section break for the specified object.
sectionStart: Word.SectionStart | "Continuous" | "NewColumn" | "NewPage" | "EvenPage" | "OddPage";
Property Value
Word.SectionStart | "Continuous" | "NewColumn" | "NewPage" | "EvenPage" | "OddPage"
Remarks
showGrid
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies whether to show the grid.
showGrid: boolean;
Property Value
boolean
Remarks
suppressEndnotes
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies if endnotes are printed at the end of the next section that doesn't suppress endnotes.
suppressEndnotes: boolean;
Property Value
boolean
Remarks
textColumns
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Gets a TextColumnCollection
object that represents the set of text columns for the PageSetup
object.
readonly textColumns: Word.TextColumnCollection;
Property Value
Remarks
topMargin
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the top margin of the page in points.
topMargin: number;
Property Value
number
Remarks
twoPagesOnOne
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies whether to print two pages per sheet.
twoPagesOnOne: boolean;
Property Value
boolean
Remarks
verticalAlignment
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the vertical alignment of text on each page in a document or section.
verticalAlignment: Word.PageSetupVerticalAlignment | "Top" | "Center" | "Justify" | "Bottom";
Property Value
Word.PageSetupVerticalAlignment | "Top" | "Center" | "Justify" | "Bottom"
Remarks
Method Details
load(options)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(options?: Word.Interfaces.PageSetupLoadOptions): Word.PageSetup;
Parameters
Provides options for which properties of the object to load.
Returns
load(propertyNames)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(propertyNames?: string | string[]): Word.PageSetup;
Parameters
- propertyNames
-
string | string[]
A comma-delimited string or an array of strings that specify the properties to load.
Returns
load(propertyNamesAndPaths)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Word.PageSetup;
Parameters
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select
is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand
is a comma-delimited string that specifies the navigation properties to load.
Returns
set(properties, options)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.
set(properties: Interfaces.PageSetupUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Word.Interfaces.PageSetupUpdateData
A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.
- options
- OfficeExtension.UpdateOptions
Provides an option to suppress errors if the properties object tries to set any read-only properties.
Returns
void
set(properties)
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Word.PageSetup): void;
Parameters
- properties
- Word.PageSetup
Returns
void
setAsTemplateDefault()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Sets the specified page setup formatting as the default for the active document and all new documents based on the active template.
setAsTemplateDefault(): void;
Returns
void
Remarks
togglePortrait()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Switches between portrait and landscape page orientations for a document or section.
togglePortrait(): void;
Returns
void
Remarks
toJSON()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Overrides the JavaScript toJSON()
method in order to provide more useful output when an API object is passed to JSON.stringify()
. (JSON.stringify
, in turn, calls the toJSON
method of the object that's passed to it.) Whereas the original Word.PageSetup
object is an API object, the toJSON
method returns a plain JavaScript object (typed as Word.Interfaces.PageSetupData
) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Word.Interfaces.PageSetupData;
Returns
track()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across .sync
calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you need to add the object to the tracked object collection when the object was first created. If this object is part of a collection, you should also track the parent collection.
track(): Word.PageSetup;
Returns
untrack()
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call context.sync()
before the memory release takes effect.
untrack(): Word.PageSetup;