Aspose::Cells::WorksheetCollection class

WorksheetCollection class

Encapsulates a collection of Worksheet objects.

class WorksheetCollection

Methods

MethodDescription
Add(SheetType type)Adds a worksheet to the collection.
Add()Adds a worksheet to the collection.
Add(const U16String& sheetName)Adds a worksheet to the collection.
Add(const char16_t* sheetName)Adds a worksheet to the collection.
AddCopy(const U16String& sheetName)Adds a worksheet to the collection and copies data from an existed worksheet.
AddCopy(const char16_t* sheetName)Adds a worksheet to the collection and copies data from an existed worksheet.
AddCopy(int32_t sheetIndex)Adds a worksheet to the collection and copies data from an existed worksheet.
AddCopy(const Vector <Worksheet>& source, const Vector <U16String>& destSheetNames)Copy a group of worksheets.
Clear()Clear all worksheets.
ClearPivottables()Clears pivot tables from the spreadsheet.
CreateRange(const U16String& address, int32_t sheetIndex)Creates a Range object from an address of the range.
CreateRange(const char16_t* address, int32_t sheetIndex)Creates a Range object from an address of the range.
CreateUnionRange(const U16String& address, int32_t sheetIndex)Creates a Range object from an address of the range.
CreateUnionRange(const char16_t* address, int32_t sheetIndex)Creates a Range object from an address of the range.
Get(int32_t index)Gets the Worksheet element at the specified index.
Get(const U16String& sheetName)Gets the Worksheet element with the specified name.
Get(const char16_t* sheetName)Gets the Worksheet element with the specified name.
GetActiveSheetIndex()Represents the index of active worksheet when the spreadsheet is opened.
GetActiveSheetName()Represents the name of active worksheet when the spreadsheet is opened.
GetBuiltInDocumentProperties()Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet.
GetCount()
GetCustomDocumentProperties()Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.
GetDxfs()Gets the master differential formatting records.
GetExternalLinks()Represents external links in a workbook.
GetNamedRanges()Gets all pre-defined named ranges in the spreadsheet.
GetNamedRangesAndTables()Gets all pre-defined named ranges in the spreadsheet.
GetNames()Gets the collection of all the Name objects in the spreadsheet.
GetOleSize()Gets and Sets displayed size when Workbook file is used as an Ole object.
GetRangeByName(const U16String& rangeName)Gets Range object by pre-defined name.
GetRangeByName(const char16_t* rangeName)Gets Range object by pre-defined name.
GetRangeByName(const U16String& rangeName, int32_t currentSheetIndex, bool includeTable)Gets Range by pre-defined name or table’s name.
GetRangeByName(const char16_t* rangeName, int32_t currentSheetIndex, bool includeTable)Gets Range by pre-defined name or table’s name.
GetRevisionLogs()Represents revision logs.
GetSheetByCodeName(const U16String& codeName)Gets the worksheet by the code name.
GetSheetByCodeName(const char16_t* codeName)Gets the worksheet by the code name.
GetTableStyles()Gets TableStyles object.
GetThreadedCommentAuthors()Gets the list of threaded comment authors.
GetWebExtensions()Gets the list of task panes.
GetWebExtensionTaskPanes()Gets the list of task panes.
GetXmlMaps()Gets and sets the XML maps in the workbook.
Insert(int32_t index, SheetType sheetType)Insert a worksheet.
Insert(int32_t index, SheetType sheetType, const U16String& sheetName)Insert a worksheet.
Insert(int32_t index, SheetType sheetType, const char16_t* sheetName)Insert a worksheet.
IsNull() constChecks whether the implementation object is nullptr.
IsRefreshAllConnections()Indicates whether refresh all connections on opening file in MS Excel.
explicit operator bool() constoperator bool()
operator=(const WorksheetCollection& src)operator=
RefreshAll()Refresh all pivot tables and charts with pivot source.
RefreshPivotTables()Refreshes all the PivotTables in the Excel file.
RefreshPivotTables(const PivotTableRefreshOption& option)Refreshes all the PivotTables in the Excel file.
RegisterAddInFunction(const U16String& addInFile, const U16String& functionName, bool lib)Adds addin function into the workbook.
RegisterAddInFunction(const char16_t* addInFile, const char16_t* functionName, bool lib)Adds addin function into the workbook.
RegisterAddInFunction(int32_t id, const U16String& functionName)Adds addin function into the workbook.
RegisterAddInFunction(int32_t id, const char16_t* functionName)Adds addin function into the workbook.
RemoveAt(const U16String& name)Removes the element at a specified name.
RemoveAt(const char16_t* name)Removes the element at a specified name.
RemoveAt(int32_t index)Removes the element at a specified index.
SetActiveSheetIndex(int32_t value)Represents the index of active worksheet when the spreadsheet is opened.
SetActiveSheetName(const U16String& value)Represents the name of active worksheet when the spreadsheet is opened.
SetActiveSheetName(const char16_t* value)Represents the name of active worksheet when the spreadsheet is opened.
SetIsRefreshAllConnections(bool value)Indicates whether refresh all connections on opening file in MS Excel.
SetOleSize(const Aspose::Cells::Object& value)Gets and Sets displayed size when Workbook file is used as an Ole object.
SetOleSize(int32_t startRow, int32_t endRow, int32_t startColumn, int32_t endColumn)Sets displayed size when Workbook file is used as an Ole object.
SetXmlMaps(const XmlMapCollection& value)Gets and sets the XML maps in the workbook.
SortNames()Sorts the defined names.
SwapSheet(int32_t sheetIndex1, int32_t sheetIndex2)Swaps the two sheets.
WorksheetCollection(WorksheetCollection_Impl* impl)Constructs from an implementation object.
WorksheetCollection(const WorksheetCollection& src)Copy constructor.
~WorksheetCollection()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
Workbook workbook;

WorksheetCollection sheets = workbook.GetWorksheets();

//Add a worksheet
sheets.Add();

//Change the name of a worksheet
sheets.Get(0).SetName(u"First Sheet");

//Set the active sheet to the second worksheet
sheets.SetActiveSheetIndex(1);
Aspose::Cells::Cleanup();

See Also