WorksheetCollection
Overview
WorksheetCollection is a class in Aspose.Cells FOSS for Typescript.
WorksheetCollection offers collection‑wide operations such as adding, removing, moving worksheets, and applying shared styles across the workbook.
This class provides 16 methods for working with WorksheetCollection objects in Typescript programs.
Available methods include: [Symbol.iterator], addWorksheet, clear, constructor, filter, find, forEach, get, getByName, getNumFmt, getStyle, indexOf, and 4 additional methods.
All public members are accessible to any Typescript application after installing the Aspose.Cells FOSS for Typescript package.
Properties: length, styles, worksheet, worksheetCount, worksheets.
Description
WorksheetCollection is a class in the Aspose.Cells FOSS library for TypeScript that exposes 15 methods and 5 properties for programmatic use.
Core capabilities include: worksheet[]; number; number. These operations enable developers to integrate worksheetcollection functionality directly into TypeScript applications.
The class also provides the worksheets property (gets the worksheets), the length property (gets the length), the worksheetCount property (gets the worksheet count).
Instances are created through a single constructor that initializes the object with default values.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
worksheets | Worksheet[] | Read | Gets the worksheets. |
length | number | Read | Gets the length. |
worksheetCount | number | Read | Gets the worksheet count. |
worksheet | Worksheet | Read | Gets the worksheet. |
styles | Map<number, Style> | Read | Gets the styles. |
Methods
| Signature | Description |
|---|---|
constructor(createDefault: boolean) | Initializes a new WorksheetCollection, optionally creating a default worksheet. |
[Symbol.iterator]() → Iterator<Worksheet> | Returns an iterator over the worksheets in the collection. |
get(index: number) → Worksheet | undefined | Returns the worksheet at the given index, or undefined if not found. |
getByName(name: string) → Worksheet | undefined | Returns the worksheet with the given name, or undefined if not found. |
map(callback: (value: Worksheet, index: number) => T) → T[] | Returns a new array containing the results of calling the callback on each worksheet. |
filter(callback: (value: Worksheet, index: number) => boolean) → Worksheet[] | Returns a new array containing only the worksheets for which the callback returns true. |
forEach(callback: (value: Worksheet, index: number) => void) | Calls the callback for each worksheet in the collection. |
find(callback: (value: Worksheet, index: number) => boolean) → Worksheet | undefined | Returns the first worksheet for which the callback returns true, or undefined if none found. |
indexOf(searchElement: Worksheet, fromIndex: number) → number | Returns the index of the given worksheet in the collection, or -1 if not found. |
addWorksheet(name: string) → Worksheet | Adds a new worksheet with the given name and returns it. |
removeWorksheet(index: number) → boolean | Removes the worksheet at the given index and returns true if successful. |
moveWorksheet(fromIndex: number, toIndex: number) → boolean | Moves the worksheet from one index to another and returns true if successful. |
getStyle(index: number) → Style | undefined | Returns the style at the given index, or undefined if not found. |
setStyle(index: number, style: Style) | Sets the style value. |
clear() | Removes all worksheets from the collection. |
getNumFmt(numFmtId: string | null) → string | Returns the number format string for the given format ID. |