ws.layout
WorksheetLayout
WorksheetLayout — Sub-API for row/column dimension and visibility operations. Provides methods to read and modify row heights, column widths, and row/column visibility (hide/unhide).
24 methods
getRowHeight
→ Promise<number>getRowHeight(row: number): Promise<number>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
Get the height of a row in pixels. @param row - Row index (0-based) @returns Row height in pixels
setRowHeight
→ Promise<void>setRowHeight(row: number, height: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
| height | number | required |
Set the height of a row. @param row - Row index (0-based) @param height - Height in pixels (must be > 0)
getColumnWidth
→ Promise<number>getColumnWidth(col: number): Promise<number>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
Get the width of a column in character-width units (relative to the Normal style font's maximum digit width, matching OOXML/Excel convention). @param col - Column index (0-based) @returns Column width in character-width units
setColumnWidth
→ Promise<void>setColumnWidth(col: number, width: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
| width | number | required |
Set the width of a column in character-width units (relative to the Normal style font's maximum digit width, matching OOXML/Excel convention). @param col - Column index (0-based) @param width - Width in character-width units (must be > 0)
getColumnWidthPx
→ Promise<number>getColumnWidthPx(col: number): Promise<number>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
Get the width of a column in pixels. @param col - Column index (0-based) @returns Column width in pixels
setColumnWidthPx
→ Promise<void>setColumnWidthPx(col: number, widthPx: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
| widthPx | number | required |
Set the width of a column in pixels. @param col - Column index (0-based) @param widthPx - Width in pixels (must be > 0)
autoFitColumn
→ Promise<void>autoFitColumn(col: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
Auto-fit a column width to its content. @param col - Column index (0-based)
autoFitColumns
→ Promise<void>autoFitColumns(cols: number[]): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| cols | number[] | required |
Auto-fit multiple columns to their content in a single batch call. @param cols - Array of column indices (0-based)
autoFitRow
→ Promise<void>autoFitRow(row: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
Auto-fit a row height to its content. @param row - Row index (0-based)
autoFitRows
→ Promise<void>autoFitRows(rows: number[]): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| rows | number[] | required |
Auto-fit multiple rows to their content in a single batch call. @param rows - Array of row indices (0-based)
getRowHeightsBatch
→ Promise<Array<[number, number]>>getRowHeightsBatch(startRow: number, endRow: number): Promise<Array<[number, number]>>;| Parameter | Type | Required |
|---|---|---|
| startRow | number | required |
| endRow | number | required |
Get row heights for a range of rows. @param startRow - Start row index (0-based, inclusive) @param endRow - End row index (0-based, inclusive) @returns Array of [rowIndex, height] pairs
getColWidthsBatch
→ Promise<Array<[number, number]>>getColWidthsBatch(startCol: number, endCol: number): Promise<Array<[number, number]>>;| Parameter | Type | Required |
|---|---|---|
| startCol | number | required |
| endCol | number | required |
Get column widths for a range of columns in character-width units (relative to the Normal style font's maximum digit width, matching OOXML/Excel convention). @param startCol - Start column index (0-based, inclusive) @param endCol - End column index (0-based, inclusive) @returns Array of [colIndex, charWidth] pairs
getColWidthsBatchPx
→ Promise<Array<[number, number]>>getColWidthsBatchPx(startCol: number, endCol: number): Promise<Array<[number, number]>>;| Parameter | Type | Required |
|---|---|---|
| startCol | number | required |
| endCol | number | required |
Get column widths for a range of columns in pixels. @param startCol - Start column index (0-based, inclusive) @param endCol - End column index (0-based, inclusive) @returns Array of [colIndex, widthPx] pairs
setRowVisible
→ Promise<void>setRowVisible(row: number, visible: boolean): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
| visible | boolean | required |
Set the visibility of a single row. @param row - Row index (0-based) @param visible - True to show, false to hide
setColumnVisible
→ Promise<void>setColumnVisible(col: number, visible: boolean): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
| visible | boolean | required |
Set the visibility of a single column. @param col - Column index (0-based) @param visible - True to show, false to hide
isRowHidden
→ Promise<boolean>isRowHidden(row: number): Promise<boolean>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
Check whether a row is hidden. @param row - Row index (0-based) @returns True if the row is hidden
isColumnHidden
→ Promise<boolean>isColumnHidden(col: number): Promise<boolean>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
Check whether a column is hidden. @param col - Column index (0-based) @returns True if the column is hidden
unhideRows
→ Promise<void>unhideRows(startRow: number, endRow: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| startRow | number | required |
| endRow | number | required |
Unhide all rows in a range. @param startRow - Start row index (0-based, inclusive) @param endRow - End row index (0-based, inclusive)
unhideColumns
→ Promise<void>unhideColumns(startCol: number, endCol: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| startCol | number | required |
| endCol | number | required |
Unhide all columns in a range. @param startCol - Start column index (0-based, inclusive) @param endCol - End column index (0-based, inclusive)
hideRows
→ Promise<void>hideRows(rows: number[]): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| rows | number[] | required |
Hide multiple rows by index. @param rows - Array of row indices to hide (0-based)
getHiddenRowsBitmap
→ Promise<Set<number>>getHiddenRowsBitmap(): Promise<Set<number>>;Get the set of all hidden row indices. @returns Set of hidden row indices
getHiddenColumnsBitmap
→ Promise<Set<number>>getHiddenColumnsBitmap(): Promise<Set<number>>;Get the set of all hidden column indices. @returns Set of hidden column indices
resetRowHeight
→ Promise<void>resetRowHeight(row: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| row | number | required |
Reset a row's height to the sheet default. @param row - Row index (0-based)
resetColumnWidth
→ Promise<void>resetColumnWidth(col: number): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| col | number | required |
Reset a column's width to the sheet default in character-width units (relative to the Normal style font's maximum digit width, matching OOXML/Excel convention). @param col - Column index (0-based)