Skip to main content

SetCenterVertically

Sets whether the worksheet is centered vertically on the page when printed.

Syntax​

expression.SetCenterVertically(bCenter);

expression - A variable that represents an ApiPageSetup class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
bCenterRequiredbooleanSpecifies whether the worksheet is centered vertically on the page.

Returns​

boolean

Example​

Center the printed content vertically on the page in a spreadsheet.

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

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

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