Skip to content
Mog is in active development. The GitHub repo, SDK packages, and community channels are not yet available. Follow for launch updates

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

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

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>;
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)

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 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]>>;
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

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)

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 in character-width units (relative to the Normal style font's maximum digit width, matching OOXML/Excel convention). @param col - Column index (0-based)