Class WorksheetCollection
Contents
[
Hide
]WorksheetCollection class
Encapsulates a collection of Worksheet
objects.
public class WorksheetCollection : CollectionBase<Worksheet>
Properties
Name | Description |
---|---|
ActiveSheetIndex { get; set; } | Represents the index of active worksheet when the spreadsheet is opened. |
ActiveSheetName { get; set; } | Represents the name of active worksheet when the spreadsheet is opened. |
BuiltInDocumentProperties { get; } | Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet. |
Capacity { get; set; } | |
Count { get; } | |
CustomDocumentProperties { get; } | Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet. |
Dxfs { get; } | Gets the master differential formatting records. |
ExternalLinks { get; } | Represents external links in a workbook. |
IsRefreshAllConnections { get; set; } | Indicates whether refresh all connections on opening file in MS Excel. |
Item { get; } | Gets the Worksheet element at the specified index. (2 indexers) |
Item { get; set; } | |
Names { get; } | Gets the collection of all the Name objects in the spreadsheet. |
OleSize { get; set; } | Gets and Sets displayed size when Workbook file is used as an Ole object. |
RevisionLogs { get; } | Represents revision logs. |
TableStyles { get; } | Gets TableStyles object. |
ThreadedCommentAuthors { get; } | Gets the list of threaded comment authors. |
WebExtensions { get; } | Gets the list of task panes. |
WebExtensionTaskPanes { get; } | Gets the list of task panes. |
XmlMaps { get; set; } | Gets and sets the XML maps in the workbook. |
Methods
Name | Description |
---|---|
Add() | Adds a worksheet to the collection. |
Add(SheetType) | Adds a worksheet to the collection. |
Add(string) | Adds a worksheet to the collection. |
AddCopy(int) | Adds a worksheet to the collection and copies data from an existed worksheet. |
AddCopy(string) | Adds a worksheet to the collection and copies data from an existed worksheet. |
AddCopy(Worksheet[], string[]) | Copy a group of worksheets. |
BinarySearch(Worksheet) | |
BinarySearch(Worksheet, IComparer<Worksheet>) | |
BinarySearch(int, int, Worksheet, IComparer<Worksheet>) | |
Clear() | Clear all worksheets. (2 methods) |
ClearPivottables() | Clears pivot tables from the spreadsheet. |
Contains(Worksheet) | |
CopyTo(Worksheet[]) | |
CopyTo(Worksheet[], int) | |
CopyTo(int, Worksheet[], int, int) | |
CreateRange(string, int) | Creates a Range object from an address of the range. |
CreateUnionRange(string, int) | Creates a Range object from an address of the range. |
Exists(Predicate<Worksheet>) | |
Find(Predicate<Worksheet>) | |
FindAll(Predicate<Worksheet>) | |
FindIndex(Predicate<Worksheet>) | |
FindIndex(int, Predicate<Worksheet>) | |
FindIndex(int, int, Predicate<Worksheet>) | |
FindLast(Predicate<Worksheet>) | |
FindLastIndex(Predicate<Worksheet>) | |
FindLastIndex(int, Predicate<Worksheet>) | |
FindLastIndex(int, int, Predicate<Worksheet>) | |
GetEnumerator() | |
GetNamedRanges() | Gets all pre-defined named ranges in the spreadsheet. |
GetNamedRangesAndTables() | Gets all pre-defined named ranges in the spreadsheet. |
GetRangeByName(string) | Gets Range object by pre-defined name. |
GetRangeByName(string, int, bool) | Gets Range by pre-defined name or table’s name |
GetSheetByCodeName(string) | Gets the worksheet by the code name. |
IndexOf(Worksheet) | |
IndexOf(Worksheet, int) | |
IndexOf(Worksheet, int, int) | |
Insert(int, SheetType) | Insert a worksheet. |
Insert(int, SheetType, string) | Insert a worksheet. |
LastIndexOf(Worksheet) | |
LastIndexOf(Worksheet, int) | |
LastIndexOf(Worksheet, int, int) | |
RefreshAll() | Refresh all pivot tables and charts with pivot source. |
RefreshPivotTables() | Refreshes all the PivotTables in the Excel file. |
RefreshPivotTables(PivotTableRefreshOption) | Refreshes all the PivotTables in the Excel file. |
RegisterAddInFunction(int, string) | Adds addin function into the workbook |
RegisterAddInFunction(string, string, bool) | Adds addin function into the workbook |
RemoveAt(int) | Removes the element at a specified index. (2 methods) |
RemoveAt(string) | Removes the element at a specified name. |
SetOleSize(int, int, int, int) | Sets displayed size when Workbook file is used as an Ole object. |
SortNames() | Sorts the defined names. |
SwapSheet(int, int) | Swaps the two sheets. |
Examples
[C#]
Workbook workbook = new Workbook();
WorksheetCollection sheets = workbook.Worksheets;
//Add a worksheet
sheets.Add();
//Change the name of a worksheet
sheets[0].Name = "First Sheet";
//Set the active sheet to the second worksheet
sheets.ActiveSheetIndex = 1;
[Visual Basic]
Dim excel as Workbook = new Workbook()
Dim sheets as WorksheetCollection = excel.Worksheets
'Add a worksheet
sheets.Add()
'Change the name of a worksheet
sheets(0).Name = "First Sheet"
'Set the active sheet to the second worksheet
sheets.ActiveSheetIndex = 1
See Also
- class CollectionBase<T>
- class Worksheet
- namespace Aspose.Cells
- assembly Aspose.Cells