跳到主要内容

SetCenterHorizontally

设置打印时工作表是否在页面上水平居中。

语法​

expression.SetCenterHorizontally(bCenter);

expression - 表示 ApiPageSetup 类的变量。

参数​

名称必需/可选数据类型默认值描述
bCenter必需boolean指定工作表是否在页面上水平居中。

返回值​

boolean

示例​

在电子表格中使打印内容在页面上水平居中。

// How do I center the worksheet between the left and right margins when printing in a spreadsheet?

// Make the printout horizontally centered on the page in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let pageSetup = worksheet.GetPageSetup();
pageSetup.SetCenterHorizontally(true);