WorksheetCollection

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

NameTypeAccessDescription
worksheetsWorksheet[]ReadGets the worksheets.
lengthnumberReadGets the length.
worksheetCountnumberReadGets the worksheet count.
worksheetWorksheetReadGets the worksheet.
stylesMap<number, Style>ReadGets the styles.

Methods

SignatureDescription
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 | undefinedReturns the worksheet at the given index, or undefined if not found.
getByName(name: string)Worksheet | undefinedReturns 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 | undefinedReturns the first worksheet for which the callback returns true, or undefined if none found.
indexOf(searchElement: Worksheet, fromIndex: number)numberReturns the index of the given worksheet in the collection, or -1 if not found.
addWorksheet(name: string)WorksheetAdds a new worksheet with the given name and returns it.
removeWorksheet(index: number)booleanRemoves the worksheet at the given index and returns true if successful.
moveWorksheet(fromIndex: number, toIndex: number)booleanMoves the worksheet from one index to another and returns true if successful.
getStyle(index: number)Style | undefinedReturns 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)stringReturns the number format string for the given format ID.

See Also