Excel.PageLayout class

Extends

属性

blackAndWhite

获取或设置工作表的黑白打印选项。Gets or sets the worksheet's black and white print option.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

bottomMargin

获取或设置要用于打印的工作表的底部页边距(以磅为单位)。Gets or sets the worksheet's bottom page margin to use for printing in points.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

centerHorizontally

获取或设置工作表的中心水平标记。Gets or sets the worksheet's center horizontally flag. 此标记确定在打印时是否水平居中工作表。This flag determines whether the worksheet will be centered horizontally when it's printed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

centerVertically

获取或设置工作表的中心垂直标记。Gets or sets the worksheet's center vertically flag. 此标记确定在打印时是否垂直居中工作表。This flag determines whether the worksheet will be centered vertically when it's printed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

draftMode

获取或设置工作表的草稿模式选项。Gets or sets the worksheet's draft mode option. 如果为 True,则将打印没有图形的工作表。If true the sheet will be printed without graphics.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

firstPageNumber

获取或设置要打印的工作表的首页页码。Gets or sets the worksheet's first page number to print. Null 值表示“自动”页码编号。Null value represents "auto" page numbering.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

footerMargin

获取或设置在打印时使用的工作表的页脚边距(以磅为单位)。Gets or sets the worksheet's footer margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

headerMargin

获取或设置在打印时使用的工作表的页眉边距(以磅为单位)。Gets or sets the worksheet's header margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

headersFooters

工作表的页眉和页脚配置。Header and footer configuration for the worksheet.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

leftMargin

获取或设置在打印时使用的工作表的左边距(以磅为单位)。Gets or sets the worksheet's left margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

orientation

获取或设置工作表的页面方向。Gets or sets the worksheet's orientation of the page.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

paperSize

获取或设置工作表的页面纸张大小。Gets or sets the worksheet's paper size of the page.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printComments

获取或设置在打印时是否应该显示工作表的批注。Gets or sets whether the worksheet's comments should be displayed when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printErrors

获取或设置工作表的打印错误选项。Gets or sets the worksheet's print errors option.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printGridlines

获取或设置工作表的打印网格线标记。Gets or sets the worksheet's print gridlines flag. 此标记确定是否打印网格线。This flag determines whether gridlines will be printed or not.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printHeadings

获取或设置工作表的打印标题标记。Gets or sets the worksheet's print headings flag. 此标记确定是否打印标题。This flag determines whether headings will be printed or not.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printOrder

获取或设置工作表的页面打印顺序选项。Gets or sets the worksheet's page print order option. 它指定用于处理打印页码的顺序。This specifies the order to use for processing the page number printed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

rightMargin

获取或设置在打印时使用的工作表的右边距(以磅为单位)。Gets or sets the worksheet's right margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

topMargin

获取或设置在打印时使用的工作表的上边距(以磅为单位)。Gets or sets the worksheet's top margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

zoom

获取或设置工作表的打印缩放选项。Gets or sets the worksheet's print zoom options. 必须PageLayoutZoomOptions将该对象设置为 JSON 对象 (使用x.zoom = {...} , 而不是x.zoom.scale = ...The PageLayoutZoomOptions object must be set as a JSON object (use x.zoom = {...} instead of x.zoom.scale = ...).

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

方法

getPrintArea()

获取包含一个或多个矩形区域的 RangeAreas 对象,它表示工作表的打印区域。Gets the RangeAreas object, comprising one or more rectangular ranges, that represents the print area for the worksheet. 如果没有打印区域,则将引发 ItemNotFound 错误。If there is no print area, an ItemNotFound error will be thrown.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintAreaOrNullObject()

获取包含一个或多个矩形区域的 RangeAreas 对象,它表示工作表的打印区域。Gets the RangeAreas object, comprising one or more rectangular ranges, that represents the print area for the worksheet. 如果没有打印区域,则将返回 null 对象。If there is no print area, a null object will be returned.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleColumns()

获取表示标题列的 Range 对象。Gets the range object representing the title columns.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleColumnsOrNullObject()

获取表示标题列的 Range 对象。Gets the range object representing the title columns. 如果未设置,则将返回 null 对象。If not set, this will return a null object.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleRows()

获取表示标题行的 Range 对象。Gets the range object representing the title rows.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleRowsOrNullObject()

获取表示标题行的 Range 对象。Gets the range object representing the title rows. 如果未设置,则将返回 null 对象。If not set, this will return a null object.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

set(properties, options)

同时设置一个对象的多个属性。Sets multiple properties of an object at the same time. 您可以传递具有相应属性的纯对象或相同类型的其他 API 对象。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.

setPrintArea(printArea)

设置工作表的打印区域。Sets the worksheet's print area.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintMargins(unit, marginOptions)

设置带单位的工作表的页边距。Sets the worksheet's page margins with units.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintMargins(unitString, marginOptions)

设置带单位的工作表的页边距。Sets the worksheet's page margins with units.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintTitleColumns(printTitleColumns)

设置列,这些列包含要在打印的工作表的每页左侧重复的单元格。Sets the columns that contain the cells to be repeated at the left of each page of the worksheet for printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintTitleRows(printTitleRows)

设置行,这些行包含要在打印的工作表的每页顶部重复的单元格。Sets the rows that contain the cells to be repeated at the top of each page of the worksheet for printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始页面布局对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.PageLayoutData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.PageLayout object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.PageLayoutData), 其中包含原始对象中所有已加载的子属性的浅表副本。) that contains shallow copies of any loaded child properties from the original object.

属性详细信息

blackAndWhite

获取或设置工作表的黑白打印选项。Gets or sets the worksheet's black and white print option.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

blackAndWhite: boolean;

属性值

boolean

bottomMargin

获取或设置要用于打印的工作表的底部页边距(以磅为单位)。Gets or sets the worksheet's bottom page margin to use for printing in points.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

bottomMargin: number;

属性值

number

centerHorizontally

获取或设置工作表的中心水平标记。Gets or sets the worksheet's center horizontally flag. 此标记确定在打印时是否水平居中工作表。This flag determines whether the worksheet will be centered horizontally when it's printed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

centerHorizontally: boolean;

属性值

boolean

示例Examples

await Excel.run(async (context) => {
    const farmSheet = context.workbook.worksheets.getItem("Print");
    farmSheet.pageLayout.centerHorizontally = true;
    farmSheet.pageLayout.centerVertically = true;
    await context.sync();
});

centerVertically

获取或设置工作表的中心垂直标记。Gets or sets the worksheet's center vertically flag. 此标记确定在打印时是否垂直居中工作表。This flag determines whether the worksheet will be centered vertically when it's printed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

centerVertically: boolean;

属性值

boolean

示例Examples

await Excel.run(async (context) => {
    const farmSheet = context.workbook.worksheets.getItem("Print");
    farmSheet.pageLayout.centerHorizontally = true;
    farmSheet.pageLayout.centerVertically = true;
    await context.sync();
});

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

context: RequestContext;

属性值

RequestContext

draftMode

获取或设置工作表的草稿模式选项。Gets or sets the worksheet's draft mode option. 如果为 True,则将打印没有图形的工作表。If true the sheet will be printed without graphics.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

draftMode: boolean;

属性值

boolean

firstPageNumber

获取或设置要打印的工作表的首页页码。Gets or sets the worksheet's first page number to print. Null 值表示“自动”页码编号。Null value represents "auto" page numbering.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

firstPageNumber: number | "";

属性值

number | ""

footerMargin

获取或设置在打印时使用的工作表的页脚边距(以磅为单位)。Gets or sets the worksheet's footer margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

footerMargin: number;

属性值

number

headerMargin

获取或设置在打印时使用的工作表的页眉边距(以磅为单位)。Gets or sets the worksheet's header margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

headerMargin: number;

属性值

number

headersFooters

工作表的页眉和页脚配置。Header and footer configuration for the worksheet.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

readonly headersFooters: Excel.HeaderFooterGroup;

属性值

leftMargin

获取或设置在打印时使用的工作表的左边距(以磅为单位)。Gets or sets the worksheet's left margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

leftMargin: number;

属性值

number

orientation

获取或设置工作表的页面方向。Gets or sets the worksheet's orientation of the page.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

orientation: Excel.PageOrientation | "Portrait" | "Landscape";

属性值

Excel.PageOrientation | "Portrait" | "Landscape"

示例Examples

await Excel.run(async (context) => {
    const farmSheet = context.workbook.worksheets.getItem("Print");
    farmSheet.pageLayout.orientation = Excel.PageOrientation.landscape;
    await context.sync();
});

paperSize

获取或设置工作表的页面纸张大小。Gets or sets the worksheet's paper size of the page.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

paperSize: Excel.PaperType | "Letter" | "LetterSmall" | "Tabloid" | "Ledger" | "Legal" | "Statement" | "Executive" | "A3" | "A4" | "A4Small" | "A5" | "B4" | "B5" | "Folio" | "Quatro" | "Paper10x14" | "Paper11x17" | "Note" | "Envelope9" | "Envelope10" | "Envelope11" | "Envelope12" | "Envelope14" | "Csheet" | "Dsheet" | "Esheet" | "EnvelopeDL" | "EnvelopeC5" | "EnvelopeC3" | "EnvelopeC4" | "EnvelopeC6" | "EnvelopeC65" | "EnvelopeB4" | "EnvelopeB5" | "EnvelopeB6" | "EnvelopeItaly" | "EnvelopeMonarch" | "EnvelopePersonal" | "FanfoldUS" | "FanfoldStdGerman" | "FanfoldLegalGerman";

属性值

Excel.PaperType | "Letter" | "LetterSmall" | "Tabloid" | "Ledger" | "Legal" | "Statement" | "Executive" | "A3" | "A4" | "A4Small" | "A5" | "B4" | "B5" | "Folio" | "Quatro" | "Paper10x14" | "Paper11x17" | "Note" | "Envelope9" | "Envelope10" | "Envelope11" | "Envelope12" | "Envelope14" | "Csheet" | "Dsheet" | "Esheet" | "EnvelopeDL" | "EnvelopeC5" | "EnvelopeC3" | "EnvelopeC4" | "EnvelopeC6" | "EnvelopeC65" | "EnvelopeB4" | "EnvelopeB5" | "EnvelopeB6" | "EnvelopeItaly" | "EnvelopeMonarch" | "EnvelopePersonal" | "FanfoldUS" | "FanfoldStdGerman" | "FanfoldLegalGerman"

printComments

获取或设置在打印时是否应该显示工作表的批注。Gets or sets whether the worksheet's comments should be displayed when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printComments: Excel.PrintComments | "NoComments" | "EndSheet" | "InPlace";

属性值

Excel.PrintComments | "NoComments" | "EndSheet" | "InPlace"

printErrors

获取或设置工作表的打印错误选项。Gets or sets the worksheet's print errors option.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printErrors: Excel.PrintErrorType | "AsDisplayed" | "Blank" | "Dash" | "NotAvailable";

属性值

Excel.PrintErrorType | "AsDisplayed" | "Blank" | "Dash" | "NotAvailable"

printGridlines

获取或设置工作表的打印网格线标记。Gets or sets the worksheet's print gridlines flag. 此标记确定是否打印网格线。This flag determines whether gridlines will be printed or not.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printGridlines: boolean;

属性值

boolean

printHeadings

获取或设置工作表的打印标题标记。Gets or sets the worksheet's print headings flag. 此标记确定是否打印标题。This flag determines whether headings will be printed or not.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printHeadings: boolean;

属性值

boolean

printOrder

获取或设置工作表的页面打印顺序选项。Gets or sets the worksheet's page print order option. 它指定用于处理打印页码的顺序。This specifies the order to use for processing the page number printed.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

printOrder: Excel.PrintOrder | "DownThenOver" | "OverThenDown";

属性值

Excel.PrintOrder | "DownThenOver" | "OverThenDown"

rightMargin

获取或设置在打印时使用的工作表的右边距(以磅为单位)。Gets or sets the worksheet's right margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

rightMargin: number;

属性值

number

topMargin

获取或设置在打印时使用的工作表的上边距(以磅为单位)。Gets or sets the worksheet's top margin, in points, for use when printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

topMargin: number;

属性值

number

zoom

获取或设置工作表的打印缩放选项。Gets or sets the worksheet's print zoom options. 必须PageLayoutZoomOptions将该对象设置为 JSON 对象 (使用x.zoom = {...} , 而不是x.zoom.scale = ...The PageLayoutZoomOptions object must be set as a JSON object (use x.zoom = {...} instead of x.zoom.scale = ...).

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

zoom: Excel.PageLayoutZoomOptions;

属性值

示例Examples

await Excel.run(async (context) => {
    const farmSheet = context.workbook.worksheets.getItem("Print");
    farmSheet.pageLayout.zoom = { scale: 200 };
    await context.sync();
});

方法详细信息

getPrintArea()

获取包含一个或多个矩形区域的 RangeAreas 对象,它表示工作表的打印区域。Gets the RangeAreas object, comprising one or more rectangular ranges, that represents the print area for the worksheet. 如果没有打印区域,则将引发 ItemNotFound 错误。If there is no print area, an ItemNotFound error will be thrown.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintArea(): Excel.RangeAreas;

返回

getPrintAreaOrNullObject()

获取包含一个或多个矩形区域的 RangeAreas 对象,它表示工作表的打印区域。Gets the RangeAreas object, comprising one or more rectangular ranges, that represents the print area for the worksheet. 如果没有打印区域,则将返回 null 对象。If there is no print area, a null object will be returned.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintAreaOrNullObject(): Excel.RangeAreas;

返回

getPrintTitleColumns()

获取表示标题列的 Range 对象。Gets the range object representing the title columns.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleColumns(): Excel.Range;

返回

getPrintTitleColumnsOrNullObject()

获取表示标题列的 Range 对象。Gets the range object representing the title columns. 如果未设置,则将返回 null 对象。If not set, this will return a null object.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleColumnsOrNullObject(): Excel.Range;

返回

getPrintTitleRows()

获取表示标题行的 Range 对象。Gets the range object representing the title rows.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleRows(): Excel.Range;

返回

getPrintTitleRowsOrNullObject()

获取表示标题行的 Range 对象。Gets the range object representing the title rows. 如果未设置,则将返回 null 对象。If not set, this will return a null object.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

getPrintTitleRowsOrNullObject(): Excel.Range;

返回

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(option?: Excel.Interfaces.PageLayoutLoadOptions): Excel.PageLayout;

参数

返回

注解

除了此签名之外, 此方法还具有以下签名:In addition to this signature, this method has the following signatures:

load(option?: string | string[]): Excel.PageLayout-Where 选项是一个逗号分隔的字符串或一个字符串数组, 用于指定要加载的属性。load(option?: string | string[]): Excel.PageLayout - Where option is a comma-delimited string or an array of strings that specify the properties to load.

load(option?: { select?: string; expand?: string; }): Excel.PageLayout-Where 选项。选择是一个用逗号分隔的字符串, 用于指定要加载的属性和选项。 expand 是一个用逗号分隔的字符串, 用于指定要加载的导航属性。load(option?: { select?: string; expand?: string; }): Excel.PageLayout - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PageLayout-仅适用于集合类型。load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PageLayout - Only available on collection types. 它类似于前面的签名。It is similar to the preceding signature. Top 指定结果中可包含的集合项的最大数量。Option.top specifies the maximum number of collection items that can be included in the result. 选项。 skip 指定要跳过且不包含在结果中的项目数。Option.skip specifies the number of items that are to be skipped and not included in the result. 如果指定了 top 选项, 则在跳过指定数目的项目后将启动结果集。If option.top is specified, the result set will start after skipping the specified number of items.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): Excel.PageLayout;

参数

propertyNames
string | string[]

一个以逗号分隔的字符串或字符串数组, 用于指定要加载的属性。A comma-delimited string or an array of strings that specify the properties to load.

返回

load(propertyNamesAndPaths)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: { select?: string; expand?: string; }): Excel.PageLayout;

参数

propertyNamesAndPaths
{ select?: string; expand?: string; }

其中, propertyNamesAndPaths 是用逗号分隔的字符串, 用于指定要加载的属性和 propertyNamesAndPaths。扩展是一个用逗号分隔的字符串, 用于指定要加载的导航属性。Where 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.

返回

set(properties, options)

同时设置一个对象的多个属性。Sets multiple properties of an object at the same time. 您可以传递具有相应属性的纯对象或相同类型的其他 API 对象。You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties: Interfaces.PageLayoutUpdateData, options?: OfficeExtension.UpdateOptions): void;

参数

properties
Interfaces.PageLayoutUpdateData

一个 JavaScript 对象, 其属性的结构 isomorphically 为在其上调用方法的对象的属性。A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.

options
OfficeExtension.UpdateOptions

提供一个选项, 以在 properties 对象尝试设置任何只读属性时禁止显示错误。Provides an option to suppress errors if the properties object tries to set any read-only properties.

返回

void

注解

此方法具有以下附加签名:This method has the following additional signature:

set(properties: Excel.PageLayout): void

set(properties)

基于现有加载的对象同时设置该对象的多个属性。Sets multiple properties on the object at the same time, based on an existing loaded object.

set(properties: Excel.PageLayout): void;

参数

properties
Excel.PageLayout

返回

void

setPrintArea(printArea)

设置工作表的打印区域。Sets the worksheet's print area.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintArea(printArea: Range | RangeAreas | string): void;

参数

printArea
Range | RangeAreas | string

要打印的内容的范围或 RangeAreas。The range, or RangeAreas of the content to print.

返回

void

示例Examples

await Excel.run(async (context) => {
    const farmSheet = context.workbook.worksheets.getItem("Print");
    farmSheet.pageLayout.setPrintArea("A1:D41");
    await context.sync();
});

setPrintMargins(unit, marginOptions)

设置带单位的工作表的页边距。Sets the worksheet's page margins with units.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintMargins(unit: Excel.PrintMarginUnit, marginOptions: Excel.PageLayoutMarginOptions): void;

参数

unit
Excel.PrintMarginUnit

提供的边距度量单位。Measurement unit for the margins provided.

marginOptions
Excel.PageLayoutMarginOptions

要设置的边距值, 未提供边距将保持不变。Margin values to set, margins not provided will remain unchanged.

返回

void

setPrintMargins(unitString, marginOptions)

设置带单位的工作表的页边距。Sets the worksheet's page margins with units.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintMargins(unitString: "Points" | "Inches" | "Centimeters", marginOptions: Excel.PageLayoutMarginOptions): void;

参数

unitString
"Points" | "Inches" | "Centimeters"

提供的边距度量单位。Measurement unit for the margins provided.

marginOptions
Excel.PageLayoutMarginOptions

要设置的边距值, 未提供边距将保持不变。Margin values to set, margins not provided will remain unchanged.

返回

void

setPrintTitleColumns(printTitleColumns)

设置列,这些列包含要在打印的工作表的每页左侧重复的单元格。Sets the columns that contain the cells to be repeated at the left of each page of the worksheet for printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintTitleColumns(printTitleColumns: Range | string): void;

参数

printTitleColumns
Range | string

每页的左侧要重复的列, 区域必须跨越整个列才能有效。The columns to be repeated to the left of each page, range must span the entire column to be valid.

返回

void

setPrintTitleRows(printTitleRows)

设置行,这些行包含要在打印的工作表的每页顶部重复的单元格。Sets the rows that contain the cells to be repeated at the top of each page of the worksheet for printing.

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

setPrintTitleRows(printTitleRows: Range | string): void;

参数

printTitleRows
Range | string

要在每个页面顶部重复的行, 范围必须跨整个行才能有效。The rows to be repeated at the top of each page, range must span the entire row to be valid.

返回

void

示例Examples

await Excel.run(async (context) => {
    const farmSheet = context.workbook.worksheets.getItem("Print");
    farmSheet.pageLayout.setPrintTitleRows("$1:$1");
    await context.sync();
});

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始页面布局对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.PageLayoutData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.PageLayout object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.PageLayoutData), 其中包含原始对象中所有已加载的子属性的浅表副本。) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Excel.Interfaces.PageLayoutData;

返回