Workbook
Overview
Workbook is a class in Aspose.Cells FOSS for Typescript.
The Workbook class provides a high‑level entry point to load existing spreadsheet files, manipulate worksheets, and save to formats such as XLSX and HTML.
This class provides 9 methods for working with Workbook objects in Typescript programs.
Available methods include: constructor, getNumFmt, load, protect, save, toCsv, toHtml, toJson, toMarkdown.
All public members are accessible to any Typescript application after installing the Aspose.Cells FOSS for Typescript package.
Properties: activeTab, borderId, cells, charts, code, col, and 15 more.
Description
Workbook is a class in the Aspose.Cells FOSS library for TypeScript that exposes 8 methods and 27 properties for programmatic use.
Core capabilities include: worksheetcollection; string[]; boolean. These operations enable developers to integrate workbook functionality directly into TypeScript applications.
The class also provides the worksheets property (gets the worksheets), the sharedStrings property (gets the shared strings), the isProtected property (gets the is protected).
Instances are created through a single constructor that initializes the object with default values.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
worksheets | WorksheetCollection | Read | Gets the worksheets. |
sharedStrings | string[] | Read | Gets the shared strings. |
isProtected | boolean | Read | Gets the is protected. |
charts | ChartInfo[] | Read | Gets the charts. |
images | ImageInfo[] | Read | Gets the images. |
activeTab | number | Read/Write | Gets the active tab. |
password | : string | Read | Gets the password. |
saveFormat | : SaveFormat | Read | Gets the save format. |
password | : string | Read | Gets the password. |
saveFormat | : SaveFormat | Read | Gets the save format. |
col | : number | Read | Gets the col. |
colOff | : number | Read | Gets the col off. |
row | : number | Read | Gets the row. |
rowOff | : number | Read | Gets the row off. |
col | : number | Read | Gets the col. |
colOff | : number | Read | Gets the col off. |
row | : number | Read | Gets the row. |
rowOff | : number | Read | Gets the row off. |
id | : number | Read | Gets the id. |
code | : string | Read | Gets the code. |
fontId | : number | Read | Gets the font id. |
fillId | : number | Read | Gets the fill id. |
borderId | : number | Read | Gets the border id. |
numFmtId | : number | Read | Gets the num fmt id. |
style | : Style | Read | Gets the style. |
sheetName | : string | Read | Gets the sheet name. |
cells | : { [key: string]: CellValue } | Read | Gets the cells. |
Methods
| Signature | Description |
|---|---|
constructor(createDefault: boolean) | Initializes a new Workbook, optionally creating a default worksheet. |
load(filePath: string, password: string) → Promise<Workbook> | Asynchronously loads a spreadsheet file from the given path and returns a Workbook instance. |
getNumFmt(numFmtId: string | null) → string | Returns the number format string for the given format ID. |
protect(protect: boolean, password: string) | Enables or disables workbook protection with the given password. |
save(filePath: string, options: { password?: string; saveFormat?: SaveFormat }) | Saves the workbook to the given file path using the specified options. |
toHtml() → string | Converts the workbook to an HTML string. |
toCsv() → string | Converts the workbook to a CSV string. |
toJson() → string | Converts the workbook to a JSON string. |
toMarkdown() → string | Converts the workbook to a Markdown string. |