/**
* This script centers the text in a table's header row cells.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first table on the current worksheet.
const currentSheet = workbook.getActiveWorksheet();
const table = currentSheet.getTables()[0];
// Get the header range.
const headerRange = table.getHeaderRowRange();
// Set the horizontal text alignment to `center`.
headerRange.getFormat().setHorizontalAlignment(ExcelScript.HorizontalAlignment.center);
}
Fields
center
centerAcrossSelection
distributed
fill
general
justify
left
right
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.