Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
ExcelScript.HorizontalAlignment enum
- Package:
- ExcelScript
Remarks
Used by
- ExcelScript.PredefinedCellStyle: getHorizontalAlignment, setHorizontalAlignment
- ExcelScript.RangeFormat: getHorizontalAlignment, setHorizontalAlignment
Examples
/**
* 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.
Office Scripts
Feedback
Was this page helpful?
