Skip to main content

SetCenterHeader

Sets the center part of the header used when the worksheet is printed.

Syntax​

expression.SetCenterHeader(sText);

expression - A variable that represents an ApiPageSetup class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
sTextRequiredstringThe center header text (may contain formatting codes such as &P, &D).

Returns​

boolean

Example​

Add center text to the page header for printing in a spreadsheet.

// How do I put text on the center side of the header in a spreadsheet?

// Show a center header when printing a spreadsheet.

let worksheet = Api.GetActiveSheet();
let pageSetup = worksheet.GetPageSetup();
pageSetup.SetCenterHeader("&A");