ViewManager
Manages a workbook’s collection of views. Access via workbook.views.
A view holds the active-sheet pointer and per-sheet selection / layout /
zoom state. Most workbooks have exactly one view (get(0)); the multi-view
model exists to support OOXML’s bookViews collection.
Use get or require to obtain a WorkbookView bound to a specific index, then call methods on it to read or write per-sheet state.
Example
Section titled “Example”const view = workbook.views.require();view.setActiveSheetName('Summary');view.setSelection('Summary', { activeCell: 'B2' });Methods
Section titled “Methods”add(): WorkbookView;Adds a workbook view and returns it.
Returns
Section titled “Returns”get(index?): WorkbookView | null;Returns the WorkbookView at the given index, or null if it does not exist.
Parameters
Section titled “Parameters”index?
Section titled “index?”number = 0
Zero-based view index. Defaults to 0 (the only view in
typical single-view workbooks).
Returns
Section titled “Returns”WorkbookView | null
getAll()
Section titled “getAll()”getAll(): WorkbookView[];Returns all workbook views as plain JSF view objects (defensive copies), not WorkbookView instances. To operate on a view, use get / require instead.
Returns
Section titled “Returns”WorkbookView[]
remove()
Section titled “remove()”remove(index): void;Removes the workbook view at the given index. Cascades to remove matching sheet views from all sheets and decrements the workbookView index on sheet views that referenced a higher index. No-op if the index is out of range or negative.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
require()
Section titled “require()”require(index?): WorkbookView;Like get, but throws if the workbook view does not exist.
Parameters
Section titled “Parameters”index?
Section titled “index?”number = 0
Zero-based view index. Defaults to 0.