Class SheetCollection
A collection of sheets in a workbook.
Inheritance
Implements
Namespace: Infragistics.Documents.Excel
Assembly: IgniteUI.Blazor.Documents.Excel.dll
Syntax
public sealed class SheetCollection : Object, IList<Sheet>, ICollection<Sheet>, IEnumerable<Sheet>, IEnumerable
Properties
Count
Gets the number of sheets in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of sheets in the collection. |
Item[Int32]
Gets the sheet at the specified index.
Declaration
public Sheet this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the sheet to get. |
Property Value
Type | Description |
---|---|
Sheet | The sheet at the specified index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
Item[String]
Gets the sheet with the specified name.
Declaration
public Sheet this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the sheet to get. |
Property Value
Type | Description |
---|---|
Sheet | The sheet with the specified name. |
Remarks
Sheet names are compared case-insensitively.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | A sheet with the specified name does not exist in the collection. |
See Also
Methods
Add(String, SheetType)
Creates a new Sheet and adds it to the collection.
Declaration
public Sheet Add(string name, SheetType type)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to give the new Sheet. |
SheetType | type | An enumeration indicating the type of sheet to create |
Returns
Type | Description |
---|---|
Sheet | The Sheet created with the specified name. |
Remarks
If the workbook originally had no sheets, the newly added sheet will become the selected sheet of the workbook. This can be changed after more sheets are added by setting the SelectedSheet of the Workbook.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
System.ArgumentException |
|
Clear()
Clears all sheets from the collection.
Declaration
public void Clear()
Remarks
If there are any NamedReference instances in the NamedReferences collection with a worksheet for a scope, they will be removed from the Workbook.
Contains(Sheet)
Determines whether a sheet is in the collection.
Declaration
public bool Contains(Sheet sheet)
Parameters
Type | Name | Description |
---|---|---|
Sheet | sheet | The sheet to locate in the collection. |
Returns
Type | Description |
---|---|
System.Boolean | True if the sheet is found; False otherwise. |
Exists(String)
Determines whether a sheet with the specified name exists in the collection.
Declaration
public bool Exists(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the sheet to search for. The name is compared case-insensitively. |
Returns
Type | Description |
---|---|
System.Boolean | True if a sheet with the specified name is found; False otherwise. |
IndexOf(Sheet)
Gets the index of the specified sheet in the collection.
Declaration
public int IndexOf(Sheet sheet)
Parameters
Type | Name | Description |
---|---|---|
Sheet | sheet | The sheet of which to get the index. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the specified sheet in the collection. |
See Also
Remove(Sheet)
Removes the specified sheet from the collection.
Declaration
public bool Remove(Sheet sheet)
Parameters
Type | Name | Description |
---|---|---|
Sheet | sheet | The sheet to remove from the collection. |
Returns
Type | Description |
---|---|
System.Boolean | True if the sheet was successfully removed from the collection; False if the sheet did not exist in the collection. |
Remarks
If there are any NamedReference instances in the NamedReferences collection with the worksheet to remove as their scope, they will be removed from the Workbook.
RemoveAt(Int32)
Removes the sheet at the specified index from the collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the sheet to remove from the collection. |
Remarks
If there are any NamedReference instances in the NamedReferences collection with the worksheet to remove as their scope, they will be removed from the Workbook.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|