TableManager
Manages every Table in a workbook. Access via workbook.tables.
Provides table-level CRUD (get, getAll, add, delete) and keeps
table refs and structured references consistent when the underlying sheet
geometry changes (row/column insertion or deletion).
Table names share a namespace with defined names: a name that is already in use as a defined name cannot be used for a table, and vice versa.
Implements
Section titled “Implements”TableHost
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TableManager(workbook): TableManager;Parameters
Section titled “Parameters”workbook
Section titled “workbook”Returns
Section titled “Returns”TableManager
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”iterator: IterableIterator<Table>;Returns
Section titled “Returns”IterableIterator<Table>
add(jsfTable): Table;Create and register a new table from a JSF table definition. Throws on validation failure (invalid name, invalid ref, name collision).
Parameters
Section titled “Parameters”jsfTable
Section titled “jsfTable”Table
Returns
Section titled “Returns”adjustTableForColEdit()
Section titled “adjustTableForColEdit()”adjustTableForColEdit( table, atCol, count): boolean;Adjust one table’s ref and column definitions after columns are inserted or deleted on its sheet, adding default-named columns when an insertion expands the table, dropping column definitions when a deletion overlaps it, and removing the table when the deletion swallows it entirely.
Parameters
Section titled “Parameters”number
0-based column where the structural edit starts
number
Positive for insertion, negative for deletion.
Returns
Section titled “Returns”boolean
true if the table’s ref was adjusted or the table was removed.
adjustTableForRowEdit()
Section titled “adjustTableForRowEdit()”adjustTableForRowEdit( table, atRow, count): boolean;Adjust one table’s ref after rows are inserted or deleted on its sheet, shrinking its header/totals row counts when a deletion overlaps them and removing the table when the deletion swallows it entirely.
Parameters
Section titled “Parameters”number
0-based row where the structural edit starts
number
Positive for insertion, negative for deletion.
Returns
Section titled “Returns”boolean
true if the table’s ref was adjusted or the table was removed.
adjustTableRefsForColMove()
Section titled “adjustTableRefsForColMove()”adjustTableRefsForColMove( sheetName, from, to, count): void;Adjust table refs after a reorderColumns operation. Column-axis mirror of adjustTableRefsForRowMove.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
number
number
number
Returns
Section titled “Returns”void
adjustTableRefsForColShift()
Section titled “adjustTableRefsForColShift()”adjustTableRefsForColShift( sheetName, atCol, count): boolean;Adjust table refs (and column definitions) after columns are inserted or deleted on a sheet. Mirrors adjustTableRefsForRowShift but along the column axis.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
number
0-based column where the edit starts
number
Positive for insertion, negative for deletion.
Returns
Section titled “Returns”boolean
true if any table’s ref was adjusted or any table was removed, in which case a recalculation is in order.
adjustTableRefsForMove()
Section titled “adjustTableRefsForMove()”adjustTableRefsForMove(fromRef, toRef): void;After a moveCells operation, update the refs of any tables that were fully contained within the source range. Tables only partially overlapping the source, or at the destination, are not affected --- matching Excel’s behavior.
Parameters
Section titled “Parameters”fromRef
Section titled “fromRef”Returns
Section titled “Returns”void
adjustTableRefsForRowMove()
Section titled “adjustTableRefsForRowMove()”adjustTableRefsForRowMove( sheetName, from, to, count): void;Adjust table refs after a reorderRows operation. The three-step insert/move/delete sequence in reorderRowsOrColumns has already moved cells; this adjusts table refs to match the net effect:
- Tables fully within the source
[from, from+count)move byto − from. - Tables fully within the displaced range shift by
±count. - Partially overlapping tables are left unchanged.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
number
0-based index of the first row that was moved
number
0-based index where the first row ended up
number
number of rows moved
Returns
Section titled “Returns”void
adjustTableRefsForRowShift()
Section titled “adjustTableRefsForRowShift()”adjustTableRefsForRowShift( sheetName, atRow, count, options?): boolean;Adjust table refs after rows are inserted or deleted on a sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
number
0-based row where the structural edit starts
number
Positive for insertion (shift down), negative for deletion
(rows atRow..atRow+|count|-1 removed, remaining shift up).
options?
Section titled “options?”exclude?
Section titled “exclude?”A table to skip (the one performing the edit).
leftCol?
Section titled “leftCol?”number
/ rightCol When provided, only tables whose columns are fully contained within [leftCol, rightCol] are affected (for column-scoped shifts such as Table.insertRow). Tables that only partially overlap are skipped to avoid misaligning their non-shifted columns.
rightCol?
Section titled “rightCol?”number
Returns
Section titled “Returns”boolean
true if any table’s ref was adjusted or any table was removed, in which case a recalculation is in order.
Implementation of
Section titled “Implementation of”TableHost.adjustTableRefsForRowShiftdelete()
Section titled “delete()”delete(name, options?): boolean;Remove a table by name. Returns false if the table does not exist.
By default only the table definition is removed; cell data is left intact.
Pass { clearData: true } to also clear cell contents in the table’s range.
Parameters
Section titled “Parameters”string
options?
Section titled “options?”clearData?
Section titled “clearData?”boolean
Returns
Section titled “Returns”boolean
get(name): Table | null;Look up a table by name (case-insensitive).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Table | null
getAll()
Section titled “getAll()”getAll(): Table[];Return all tables in the workbook.
Returns
Section titled “Returns”Table[]
getIntersecting()
Section titled “getIntersecting()”getIntersecting(sheetName, range): Table[];Return the tables on sheetName whose range intersects range.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
Returns
Section titled “Returns”Table[]