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

NameTypeAccessDescription
worksheetsWorksheetCollectionReadGets the worksheets.
sharedStringsstring[]ReadGets the shared strings.
isProtectedbooleanReadGets the is protected.
chartsChartInfo[]ReadGets the charts.
imagesImageInfo[]ReadGets the images.
activeTabnumberRead/WriteGets the active tab.
password: stringReadGets the password.
saveFormat: SaveFormatReadGets the save format.
password: stringReadGets the password.
saveFormat: SaveFormatReadGets the save format.
col: numberReadGets the col.
colOff: numberReadGets the col off.
row: numberReadGets the row.
rowOff: numberReadGets the row off.
col: numberReadGets the col.
colOff: numberReadGets the col off.
row: numberReadGets the row.
rowOff: numberReadGets the row off.
id: numberReadGets the id.
code: stringReadGets the code.
fontId: numberReadGets the font id.
fillId: numberReadGets the fill id.
borderId: numberReadGets the border id.
numFmtId: numberReadGets the num fmt id.
style: StyleReadGets the style.
sheetName: stringReadGets the sheet name.
cells: { [key: string]: CellValue }ReadGets the cells.

Methods

SignatureDescription
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)stringReturns 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()stringConverts the workbook to an HTML string.
toCsv()stringConverts the workbook to a CSV string.
toJson()stringConverts the workbook to a JSON string.
toMarkdown()stringConverts the workbook to a Markdown string.

See Also