[]
public class XLSheetCollection : IEnumerable
Provides methods and properties for counting, enumerating, adding, and removing sheets from the workbook.
Use the C1XLBookSheets property to get the book's sheet collection. For example, the code below gets a reference to the first sheet on the book and then prints the sheet's name:
C1XLBook book = new C1XLBook();
XLSheet sheet = book.Sheets[0];
Debug.WriteLine(sheet.Name);
Name | Description |
---|---|
Book | Gets a reference to the C1XLBook that owns the collection. |
Count | Gets the number of XLSheet objects in the collection. |
FirstIndex | Gets or sets the index of the sheet that is initially opened when a C1XLBook file is loaded into Excel. |
this[int] | Gets the XLSheet at a given position in the collection. |
this[string] | Gets the XLSheet with the given name (case-insensitive). |
SelectedIndex | Gets or sets the index of the sheet that is selected when a C1XLBook file is loaded into Excel. |
SelectedIndexes | Gets or sets the index array of the sheets that is selected when a C1XLBook file is loaded into Excel. |
Name | Description |
---|---|
Add() | Creates a new XLSheet and appends it to the collection. |
Add(XLSheet) | Appends an existing XLSheet to the collection. |
Add(string) | Creates a new XLSheet with a given name and appends it to the collection. |
AddToSelected(XLSheet) | Adds a worksheet to the selected sheets. |
Clear() | Removes all items from the collection. |
Contains(XLSheet) | Determines whether the collection contains a specific XLSheet object. |
Contains(string) | Determines whether the collection contains an XLSheet object with a given name. |
IndexOf(XLSheet) | Gets the index of a given XLSheet in the collection. |
IndexOf(string) | Gets the position of the sheet with the specified name in the collection. |
Insert(int) | Creates a new XLSheet and inserts it at a specific position in the collection. |
Insert(int, XLSheet) | Inserts an XLSheet object into the collection at the specified position. |
IsSelected(XLSheet) | Gets information about whether the worksheet is selected or not. |
Remove(XLSheet) | Removes an XLSheet from the collection. |
Remove(string) | Removes the XLSheet with the specified name from the collection. |
RemoveAt(int) | Removes the XLSheet at a specific index from the collection. |