Class WorksheetsCollection
Class for managing the collection of WorkSheet elements.
Inheritance
Implements
Namespace: IronXL
Assembly: IronXL.dll
Syntax
public class WorksheetsCollection : Object, IList<WorkSheet>, ICollection<WorkSheet>, IEnumerable<WorkSheet>, IEnumerable
Properties
Count
Gets the number of elements contained in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The count of worksheets. |
IsReadOnly
Gets a value indicating whether the collection is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[Int32]
Gets or sets the WorkSheet at the specified index.
Declaration
public WorkSheet this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Property Value
Type | Description |
---|---|
WorkSheet | The WorkSheet. |
Methods
Add(WorkSheet)
Adds an object to the end of the collection.
Declaration
public void Add(WorkSheet item)
Parameters
Type | Name | Description |
---|---|---|
WorkSheet | item | The object to be added to the end of the collection. |
Clear()
Delete all worksheets in the list.
Declaration
public void Clear()
Contains(WorkSheet)
Determines whether worksheets collection contains the element.
Declaration
public bool Contains(WorkSheet item)
Parameters
Type | Name | Description |
---|---|---|
WorkSheet | item | The element to find. |
Returns
Type | Description |
---|---|
System.Boolean |
|
CopyTo(WorkSheet[], Int32)
Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.
Declaration
public void CopyTo(WorkSheet[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
WorkSheet[] | array | The destination of the elements copied from collection. The array must have zero-based indexing. |
System.Int32 | arrayIndex | The zero-based index in |
Create(String)
Create new worksheet with the specified name.
Declaration
public WorkSheet Create(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the new worksheet. |
Returns
Type | Description |
---|---|
WorkSheet | A new WorkSheet within the workbook. |
FindIndex(Predicate<WorkSheet>)
Searches for an element that matches the conditions defined by the specified predicate.
Declaration
public int FindIndex(Predicate<WorkSheet> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Predicate<WorkSheet> | predicate | The predicate delegate that defines the conditions of the element to search for. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first occurrence of an element that matches
the conditions defined by |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<WorkSheet> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<WorkSheet> | An enumerator that can be used to iterate through the collection. |
IndexOf(WorkSheet)
Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.
Declaration
public int IndexOf(WorkSheet item)
Parameters
Type | Name | Description |
---|---|---|
WorkSheet | item | The object to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first occurrence of |
Insert(Int32, WorkSheet)
Inserts an element into the collection at the specified index.
Declaration
public void Insert(int index, WorkSheet item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which |
WorkSheet | item | The object to insert. |
Remove(WorkSheet)
Removes the specified WorkSheet item.
Declaration
public bool Remove(WorkSheet item)
Parameters
Type | Name | Description |
---|---|---|
WorkSheet | item | The item to remove. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RemoveAt(Int32)
Removes the element at the specified index of collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to remove. |
SetSheetIndex(WorkSheet, Int32)
Sets the order of appearance for a given sheet.
Declaration
public void SetSheetIndex(WorkSheet sheet, int index)
Parameters
Type | Name | Description |
---|---|---|
WorkSheet | sheet | The sheet to reorder. |
System.Int32 | index | The index to insert into. |