Skip to content

ws.layout

WorksheetLayout

Sub-API for row/column layout operations on a worksheet.

30 methods

getRowHeight

Promise<number>
getRowHeight(row: number): Promise<number>;
ParameterTypeRequired
rownumberrequired

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>;
ParameterTypeRequired
rownumberrequired
heightnumberrequired

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>;
ParameterTypeRequired
colnumberrequired

Get the width of a column in pixels. @param col - Column index (0-based) @returns Column width in pixels

setColumnWidth

Promise<void>
setColumnWidth(col: number, widthPx: number): Promise<void>;
ParameterTypeRequired
colnumberrequired
widthPxnumberrequired

Set the width of a column in pixels. @param col - Column index (0-based) @param widthPx - Width in pixels (must be > 0)

getColumnWidthChars

Promise<number>
getColumnWidthChars(col: number): Promise<number>;
ParameterTypeRequired
colnumberrequired

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

setColumnWidthChars

Promise<void>
setColumnWidthChars(col: number, widthChars: number): Promise<void>;
ParameterTypeRequired
colnumberrequired
widthCharsnumberrequired

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 widthChars - Width in character-width units (must be > 0)

setColumnWidths

Promise<void>
setColumnWidths(widths: Array<[number, number]>): Promise<void>;
ParameterTypeRequired
widthsArray<[number, number]>required

Set multiple column widths in pixels. @param widths - Array of [columnIndex, widthPx] pairs

setColumnWidthsChars

Promise<void>
setColumnWidthsChars(widths: Array<[number, number]>): Promise<void>;
ParameterTypeRequired
widthsArray<[number, number]>required

Set multiple column widths in character-width units. @param widths - Array of [columnIndex, widthChars] pairs

autoFitColumn

Promise<void>
autoFitColumn(col: number): Promise<void>;
ParameterTypeRequired
colnumberrequired

Auto-fit a column width to its content. @param col - Column index (0-based)

autoFitColumns

Promise<void>
autoFitColumns(cols: number[]): Promise<void>;
ParameterTypeRequired
colsnumber[]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>;
ParameterTypeRequired
rownumberrequired

Auto-fit a row height to its content. @param row - Row index (0-based)

autoFitRows

Promise<void>
autoFitRows(rows: number[]): Promise<void>;
ParameterTypeRequired
rowsnumber[]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]>>;
ParameterTypeRequired
startRownumberrequired
endRownumberrequired

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]>>;
ParameterTypeRequired
startColnumberrequired
endColnumberrequired

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

getColWidthsBatchChars

Promise<Array<[number, number]>>
getColWidthsBatchChars(startCol: number, endCol: number): Promise<Array<[number, number]>>;
ParameterTypeRequired
startColnumberrequired
endColnumberrequired

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

setRowVisible

Promise<void>
setRowVisible(row: number, visible: boolean): Promise<void>;
ParameterTypeRequired
rownumberrequired
visiblebooleanrequired

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>;
ParameterTypeRequired
colnumberrequired
visiblebooleanrequired

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>;
ParameterTypeRequired
rownumberrequired

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>;
ParameterTypeRequired
colnumberrequired

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>;
ParameterTypeRequired
startRownumberrequired
endRownumberrequired

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>;
ParameterTypeRequired
startColnumberrequired
endColnumberrequired

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>;
ParameterTypeRequired
rowsnumber[]required

Hide multiple rows by index. @param rows - Array of row indices to hide (0-based)

hideColumns

Promise<void>
hideColumns(cols: number[]): Promise<void>;
ParameterTypeRequired
colsnumber[]required

Hide multiple columns by index. @param cols - Array of column 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>;
ParameterTypeRequired
rownumberrequired

Reset a row's height to the sheet default. @param row - Row index (0-based)

resetColumnWidth

Promise<void>
resetColumnWidth(col: number): Promise<void>;
ParameterTypeRequired
colnumberrequired

Reset a column's width to the sheet default. @param col - Column index (0-based)

getRowPosition

Promise<number>
getRowPosition(row: number): Promise<number>;
ParameterTypeRequired
rownumberrequired

Get the pixel offset of a row's top edge from the worksheet origin. @param row - Row index (0-based) @returns Pixel offset from the top of the worksheet

getColPosition

Promise<number>
getColPosition(col: number): Promise<number>;
ParameterTypeRequired
colnumberrequired

Get the pixel offset of a column's left edge from the worksheet origin. @param col - Column index (0-based) @returns Pixel offset from the left of the worksheet

getRangePosition

Promise<RangePixelPosition>
getRangePosition(range: CellRange): Promise<RangePixelPosition>;
ParameterTypeRequired
rangeCellRangerequired

Get the pixel bounds of a range (top, left, height, width). Returns range pixel bounds in a single call. @param range - The cell range to measure @returns Pixel bounds relative to the worksheet origin