Class WorksheetsCollection
A collection of all the Worksheet objects in the specified or active workbook. Each Worksheet object represents a worksheet.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation.Collections
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public class WorksheetsCollection : CollectionBaseEx<IWorksheet>, IList<IWorksheet>, ICollection<IWorksheet>, IParentApplication, IWorksheets, IEnumerable<IWorksheet>, IEnumerable, ICloneParent
Constructors
WorksheetsCollection(IApplication, Object)
Creates a collection and sets its Application and Parent properties.
Declaration
public WorksheetsCollection(IApplication application, object parent)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object for the collection. |
System.Object | parent | Parent object for the collection. |
Properties
IsRightToLeft
Indicates whether worksheet is displayed right to left.
Declaration
public bool IsRightToLeft { get; set; }
Property Value
Type |
---|
System.Boolean |
Item[Int32]
Returns a single object from a collection. Read-only.
Declaration
public IWorksheet this[int Index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Index |
Property Value
Type |
---|
IWorksheet |
Item[String]
Returns a single object from a collection. Read-only.
Declaration
public IWorksheet this[string sheetName] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | sheetName |
Property Value
Type |
---|
IWorksheet |
UseHashForWorksheetLookup
Toggles worksheet search algorithm when searching worksheet by name.
Declaration
public bool UseHashForWorksheetLookup { get; set; }
Property Value
Type |
---|
System.Boolean |
UseRangesCache
Indicates whether all created range objects should be cached.
Declaration
public bool UseRangesCache { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
Add(BiffReader, ExcelParseOptions, Boolean, Dictionary<Int32, Int32>, IDecryptor)
Add worksheet from reader.
Declaration
[CLSCompliant(false)]
public IWorksheet Add(BiffReader reader, ExcelParseOptions options, bool bSkipParsing, Dictionary<int, int> hashNewXFormatIndexes, IDecryptor decryptor)
Parameters
Type | Name | Description |
---|---|---|
BiffReader | reader | Reader which contains worksheet. |
ExcelParseOptions | options | Parse options. |
System.Boolean | bSkipParsing | Indicates whether worksheet should be parsed. |
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | hashNewXFormatIndexes | Dictionary with new extended format indexes used in ignore styles mode. |
IDecryptor | decryptor | Object used to decrypt encrypted records. |
Returns
Type | Description |
---|---|
IWorksheet | Read worksheet. |
Add(String)
Adds an empty worksheet.
Declaration
public IWorksheet Add(string sheetName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sheetName | Name of the newly created worksheet. |
Returns
Type | Description |
---|---|
IWorksheet | Newly created worksheet. |
AddCopy(IWorksheet)
Adds copy of worksheet.
Declaration
public IWorksheet AddCopy(IWorksheet sheet)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | sheet | Worksheet to copy. |
Returns
Type | Description |
---|---|
IWorksheet | Copy of worksheet that was added. |
AddCopy(IWorksheet, ExcelWorksheetCopyFlags)
Adds copy of worksheet.
Declaration
public IWorksheet AddCopy(IWorksheet sheet, ExcelWorksheetCopyFlags flags)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | sheet | Worksheet to copy. |
ExcelWorksheetCopyFlags | flags | Represents copy flags. |
Returns
Type | Description |
---|---|
IWorksheet | Copy of worksheet that was added. |
AddCopy(IWorksheets)
Adding worksheets collection to current workbook.
Declaration
public void AddCopy(IWorksheets worksheets)
Parameters
Type | Name | Description |
---|---|---|
IWorksheets | worksheets | Source worksheets collection. |
AddCopy(IWorksheets, ExcelWorksheetCopyFlags)
Adding worksheets collection to current workbook.
Declaration
public void AddCopy(IWorksheets worksheets, ExcelWorksheetCopyFlags flags)
Parameters
Type | Name | Description |
---|---|---|
IWorksheets | worksheets | Source worksheets collection. |
ExcelWorksheetCopyFlags | flags | Represents copy option flags. |
AddCopy(Int32)
Add a copy of the specified worksheet to the worksheet collection.
Declaration
public IWorksheet AddCopy(int sheetIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | sheetIndex | Index of the workbook that should be copied |
Returns
Type | Description |
---|---|
IWorksheet | Returns copied sheet. |
AddCopy(Int32, ExcelWorksheetCopyFlags)
Add a copy of the specified worksheet to the worksheet collection.
Declaration
public IWorksheet AddCopy(int sheetIndex, ExcelWorksheetCopyFlags flags)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | sheetIndex | Index of the workbook that should be copied |
ExcelWorksheetCopyFlags | flags | Represents copy options flags. |
Returns
Type | Description |
---|---|
IWorksheet | Returns copied sheet. |
AddCopyAfter(IWorksheet)
Adds copy of sheet to collection after chosen sheet.
Declaration
public IWorksheet AddCopyAfter(IWorksheet toCopy)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | toCopy | Represents worksheet to copy. |
Returns
Type | Description |
---|---|
IWorksheet | Returns copied sheet. |
AddCopyAfter(IWorksheet, IWorksheet)
Adds copy of sheet to collection before chosen sheet.
Declaration
public IWorksheet AddCopyAfter(IWorksheet toCopy, IWorksheet sheetBefore)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | toCopy | Represents worksheet to copy. |
IWorksheet | sheetBefore | Represents sheet that, in collection must be before copied sheet. |
Returns
Type | Description |
---|---|
IWorksheet | Returns copied sheet. |
AddCopyBefore(IWorksheet)
Adds copy of sheet to collection before chosen sheet.
Declaration
public IWorksheet AddCopyBefore(IWorksheet toCopy)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | toCopy | Represents worksheet to copy. |
Returns
Type | Description |
---|---|
IWorksheet | Returns copied sheet. |
AddCopyBefore(IWorksheet, IWorksheet)
Adds copy of sheet to collection before chosen sheet.
Declaration
public IWorksheet AddCopyBefore(IWorksheet toCopy, IWorksheet sheetAfter)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | toCopy | Represents worksheet to copy. |
IWorksheet | sheetAfter | Represents sheet that, in collection must be after copied sheet. |
Returns
Type | Description |
---|---|
IWorksheet | Returns copied sheet. |
Create()
Creates empty worksheet with automatically generated name.
Declaration
public IWorksheet Create()
Returns
Type | Description |
---|---|
IWorksheet | Reference on created worksheet. |
Create(String)
Creates empty worksheet with specified name.
Declaration
public IWorksheet Create(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | New name of worksheet. Must be unique for collection. |
Returns
Type | Description |
---|---|
IWorksheet | Reference on created worksheet. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | When specified name is NULL. |
FindAll(Boolean)
This method searches for the all cells with specified bool value.
Declaration
public IRange[] FindAll(bool findValue)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | findValue | Value to search. |
Returns
Type | Description |
---|---|
IRange[] | All found cells, or Null if value was not found. |
FindAll(DateTime)
This method searches for the all cells with specified DateTime value.
Declaration
public IRange[] FindAll(DateTime findValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | findValue | Value to search. |
Returns
Type | Description |
---|---|
IRange[] | All found cells, or Null if value was not found. |
FindAll(Double, ExcelFindType)
This method searches for the all cells with specified double value.
Declaration
public IRange[] FindAll(double findValue, ExcelFindType flags)
Parameters
Type | Name | Description |
---|---|---|
System.Double | findValue | Value to search. |
ExcelFindType | flags | Type of value to search. |
Returns
Type | Description |
---|---|
IRange[] | All found cells, or Null if value was not found. |
FindAll(String, ExcelFindType)
This method searches for the all cells with specified string value.
Declaration
public IRange[] FindAll(string findValue, ExcelFindType flags)
Parameters
Type | Name | Description |
---|---|---|
System.String | findValue | Value to search. |
ExcelFindType | flags | Type of value to search. |
Returns
Type | Description |
---|---|
IRange[] | All found cells, or Null if value was not found. |
FindAll(String, ExcelFindType, ExcelFindOptions)
This method searches for the all cells with specified string value.
Declaration
public IRange[] FindAll(string findValue, ExcelFindType flags, ExcelFindOptions findOptions)
Parameters
Type | Name | Description |
---|---|---|
System.String | findValue | Value to search. |
ExcelFindType | flags | Type of value to search. |
ExcelFindOptions | findOptions | Way to search. |
Returns
Type | Description |
---|---|
IRange[] | All found cells, or Null if value was not found. |
FindAll(TimeSpan)
This method searches for the all cells with specified TimeSpan value.
Declaration
public IRange[] FindAll(TimeSpan findValue)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | findValue | Value to search. |
Returns
Type | Description |
---|---|
IRange[] | All found cells, or Null if value was not found. |
FindFirst(Boolean)
This method searches for the first cell with specified bool value.
Declaration
public IRange FindFirst(bool findValue)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | findValue | Value to search. |
Returns
Type | Description |
---|---|
IRange | First found cell, or Null if value was not found. |
FindFirst(DateTime)
This method searches for the first cell with specified DateTime value.
Declaration
public IRange FindFirst(DateTime findValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | findValue | Value to search. |
Returns
Type | Description |
---|---|
IRange | First found cell, or Null if value was not found. |
FindFirst(Double, ExcelFindType)
This method searches for the first cell with specified double value.
Declaration
public IRange FindFirst(double findValue, ExcelFindType flags)
Parameters
Type | Name | Description |
---|---|---|
System.Double | findValue | Value to search. |
ExcelFindType | flags | Type of value to search. |
Returns
Type | Description |
---|---|
IRange | First found cell, or Null if value was not found. |
FindFirst(String, ExcelFindType)
This method searches for the first cell with specified string value.
Declaration
public IRange FindFirst(string findValue, ExcelFindType flags)
Parameters
Type | Name | Description |
---|---|---|
System.String | findValue | Value to search. |
ExcelFindType | flags | Type of value to search. |
Returns
Type | Description |
---|---|
IRange | First found cell, or Null if value was not found. |
FindFirst(String, ExcelFindType, ExcelFindOptions)
This method searches for the first cell with specified string value.
Declaration
public IRange FindFirst(string findValue, ExcelFindType flags, ExcelFindOptions findOptions)
Parameters
Type | Name | Description |
---|---|---|
System.String | findValue | Value to search. |
ExcelFindType | flags | Type of value to search. |
ExcelFindOptions | findOptions |
Returns
Type | Description |
---|---|
IRange | First found cell, or Null if value was not found. |
FindFirst(TimeSpan)
This method searches for the first cell with specified TimeSpan value.
Declaration
public IRange FindFirst(TimeSpan findValue)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | findValue | Value to search. |
Returns
Type | Description |
---|---|
IRange | First found cell, or Null if value was not found. |
InnerAdd(IWorksheet)
Adds worksheet into internal collection.
Declaration
public void InnerAdd(IWorksheet sheet)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | sheet | Worksheet to add. |
InnerRemove(Int32)
Removes specified worksheet from the collection.
Declaration
public void InnerRemove(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index of the sheet to remove. |
Move(Int32, Int32)
Moves worksheet inside this collection only.
Declaration
public void Move(int iOldIndex, int iNewIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iOldIndex | Old index in the collection. |
System.Int32 | iNewIndex | New index in the collection. |
OnClearComplete()
OnClear is invoked after Clear behavior.
Declaration
protected override void OnClearComplete()
Overrides
OnInsertComplete(Int32, IWorksheet)
Performs additional processes after inserting a new element into the collection.
Declaration
protected override void OnInsertComplete(int index, IWorksheet value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which to insert value. |
IWorksheet | value | The new value of the element at the index. |
Overrides
OnRemoveComplete(Int32, IWorksheet)
Performs additional processes after removing an element from the collection.
Declaration
protected override void OnRemoveComplete(int index, IWorksheet value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which value can be found. |
IWorksheet | value | The value of the element to remove from the index. |
Overrides
OnSetComplete(Int32, IWorksheet, IWorksheet)
Performs additional processes after setting a value in the collection.
Declaration
protected override void OnSetComplete(int index, IWorksheet oldValue, IWorksheet newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which oldValue can be found. |
IWorksheet | oldValue | The value to replace with newValue. |
IWorksheet | newValue | The new value of the element at the index. |
Overrides
Remove(IWorksheet)
Remove specified worksheet from workbook collection.
Declaration
public void Remove(IWorksheet sheet)
Parameters
Type | Name | Description |
---|---|---|
IWorksheet | sheet | Reference on worksheet to remove. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When specified sheet is last sheet in the workbook. |
Remove(Int32)
Removes specified worksheet from the collection.
Declaration
public void Remove(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index of the sheet to remove. |
Remove(String)
Removes specified worksheet from the collection.
Declaration
public void Remove(string sheetName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sheetName | Name of the sheet to remove. |
RemoveLocal(String)
Removes all references to worksheet from the current collection.
Declaration
protected void RemoveLocal(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Worksheet's name to remove. |
UpdateSheetIndex(WorksheetImpl, Int32)
Updates sheet index after move/insert operation.
Declaration
public void UpdateSheetIndex(WorksheetImpl sheet, int iOldRealIndex)
Parameters
Type | Name | Description |
---|---|---|
WorksheetImpl | sheet | Sheet that was changed. |
System.Int32 | iOldRealIndex | Old sheet index in the TabSheets collection. |
UpdateStringIndexes(List<Int32>)
Updates string indexes.
Declaration
public void UpdateStringIndexes(List<int> arrNewIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Int32> | arrNewIndexes | List with new indexes. |