SheetCollection
Ordered collection of sheets in a workbook, managing sheet creation, insertion, removal, visibility, and active sheet tracking with validation and event notifications.
Definition
Namespace:Telerik.Windows.Documents.Spreadsheet.Model
Assembly:Telerik.Windows.Documents.Spreadsheet.dll
Syntax:
public class SheetCollection : IEnumerable<Sheet>, IEnumerable
Inheritance: objectSheetCollection
Implements:
Events
Raised when the active sheet reference changes, allowing UI to switch displayed content.
public event EventHandler ActiveSheetChanged
Raised when the active sheet's index changes, allowing UI to update tab selection.
public event EventHandler ActiveSheetIndexChanged
Raised after a sheet operation completes (add, remove, hide, unhide, move, clear), providing change details.
public event EventHandler<SheetCollectionChangedEventArgs> Changed
Methods
Checks whether a sheet with the specified name exists in the collection, using case-insensitive comparison.
Returns an enumerator for iterating through all sheets in order.
public IEnumerator<Sheet> GetEnumerator()
A IEnumerator<T> that can be used to iterate through the collection.
Implements:
Hides the currently active sheet, ensuring at least one visible sheet remains.
public void Hide()
Hides the sheet at the specified index, ensuring at least one visible sheet remains.
Hides the specified sheet, ensuring at least one visible sheet remains.
Raises the ActiveSheetChanged event, notifying subscribers of sheet change.
protected virtual void OnActiveSheetChanged()
Raises the ActiveSheetIndexChanged event, notifying subscribers of index change.
protected virtual void OnActiveSheetIndexChanged()
Raises the Changed event, notifying subscribers of completed collection modification.
protected virtual void OnChanged(SheetCollectionChangedEventArgs args)
The SheetCollectionChangedEventArgs instance containing the event data.
Removes the currently active sheet from the collection, ensuring at least one visible sheet remains.
public void Remove()
Removes the sheet at the specified index, ensuring at least one visible sheet remains.
Makes the sheet at the specified index visible and sets it as the active sheet.
Makes the specified sheet visible and sets it as the active sheet.
Properties
Currently selected sheet displayed to the user; must be a sheet from this collection.
public Sheet ActiveSheet { get; set; }
The active sheet.
Zero-based index of the active sheet, or -1 if no sheets exist; setting updates both index and ActiveSheet.
public int ActiveSheetIndex { get; set; }
The index of the active sheet.
Total number of sheets in the collection, including hidden and very hidden sheets.
public int Count { get; }
The count of the sheets.
Retrieves the sheet at the specified zero-based index.
Retrieves the sheet with the specified name, using case-insensitive comparison.