skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class SheetCollection

Ordered collection of sheets in a workbook, managing sheet creation, insertion, removal, visibility, and active sheet tracking with validation and event notifications.

Inheritance
System.Object
SheetCollection
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Documents.Spreadsheet.Model
Assembly: Telerik.Windows.Documents.Spreadsheet.dll

Syntax

public class SheetCollection : IEnumerable<Sheet>, IEnumerable

Properties

ActiveSheet

Currently selected sheet displayed to the user; must be a sheet from this collection.

Declaration
public Sheet ActiveSheet { get; set; }
Property Value
Sheet

The active sheet.

ActiveSheetIndex

Zero-based index of the active sheet, or -1 if no sheets exist; setting updates both index and ActiveSheet.

Declaration
public int ActiveSheetIndex { get; set; }
Property Value
System.Int32

The index of the active sheet.

Count

Total number of sheets in the collection, including hidden and very hidden sheets.

Declaration
public int Count { get; }
Property Value
System.Int32

The count of the sheets.

Item[Int32]

Retrieves the sheet at the specified zero-based index.

Declaration
public Sheet this[int index] { get; }
Parameters
System.Int32 index

Property Value
Sheet

The sheet.

Item[String]

Retrieves the sheet with the specified name, using case-insensitive comparison.

Declaration
public Sheet this[string sheetName] { get; }
Parameters
System.String sheetName

Property Value
Sheet

The sheet.

Workbook

Workbook that owns this collection, providing the context for sheet operations.

Declaration
public Workbook Workbook { get; }
Property Value
Workbook

The workbook.

Methods

Add(SheetType)

Creates a new sheet of the specified type with a generated unique name and appends it to the collection.

Declaration
public Sheet Add(SheetType type)
Parameters
SheetType type

The type of sheet.

Returns
Sheet

The newly created sheet.

Contains(String)

Checks whether a sheet with the specified name exists in the collection, using case-insensitive comparison.

Declaration
public bool Contains(string sheetName)
Parameters
System.String sheetName

The name of the sheet.

Returns
System.Boolean

The value indicating whether a sheet with the specified name is contained in the collection.

Contains(Sheet)

Checks whether the specified sheet exists in this collection.

Declaration
public bool Contains(Sheet sheet)
Parameters
Sheet sheet

The sheet.

Returns
System.Boolean

The value indicating whether the sheet is contained in the collection.

GetByName(String)

Retrieves the sheet with the specified name using case-insensitive comparison, or null if not found.

Declaration
public Sheet GetByName(string sheetName)
Parameters
System.String sheetName

The name of the sheet.

Returns
Sheet

The sheet.

GetEnumerator()

Returns an enumerator for iterating through all sheets in order.

Declaration
public IEnumerator<Sheet> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<Sheet>

A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.

Implements
System.Collections.Generic.IEnumerable<T>.GetEnumerator()

Hide()

Hides the currently active sheet, ensuring at least one visible sheet remains.

Declaration
public void Hide()

Hide(Int32)

Hides the sheet at the specified index, ensuring at least one visible sheet remains.

Declaration
public void Hide(int index)
Parameters
System.Int32 index

The index.

Hide(Sheet)

Hides the specified sheet, ensuring at least one visible sheet remains.

Declaration
public void Hide(Sheet sheet)
Parameters
Sheet sheet

The sheet.

IndexOf(String)

Searches for a sheet with the specified name using case-insensitive comparison and returns its zero-based index, or -1 if not found.

Declaration
public int IndexOf(string sheetName)
Parameters
System.String sheetName

The name of the sheet.

Returns
System.Int32

The index of the sheet.

IndexOf(Sheet)

Searches for the specified sheet and returns its zero-based index, or -1 if not found.

Declaration
public int IndexOf(Sheet sheet)
Parameters
Sheet sheet

The sheet.

Returns
System.Int32

The index of the sheet.

Insert(Int32, SheetType)

Creates a new sheet of the specified type with a generated unique name and inserts it at the specified index.

Declaration
public Sheet Insert(int index, SheetType type)
Parameters
System.Int32 index

The index.

SheetType type

The type.

Returns
Sheet

The newly created sheet.

Insert(SheetType)

Creates a new sheet of the specified type with a generated unique name and inserts it at the active sheet's index.

Declaration
public Sheet Insert(SheetType type)
Parameters
SheetType type

The type.

Returns
Sheet

The newly created sheet.

Move(Int32, Int32, Int32)

Relocates a contiguous range of sheets from the source index to the destination index, shifting other sheets as needed.

Declaration
public void Move(int fromIndex, int itemCount, int toIndex)
Parameters
System.Int32 fromIndex

From index.

System.Int32 itemCount

The item count.

System.Int32 toIndex

To index.

OnActiveSheetChanged()

Raises the ActiveSheetChanged event, notifying subscribers of sheet change.

Declaration
protected virtual void OnActiveSheetChanged()

OnActiveSheetIndexChanged()

Raises the ActiveSheetIndexChanged event, notifying subscribers of index change.

Declaration
protected virtual void OnActiveSheetIndexChanged()

OnChanged(SheetCollectionChangedEventArgs)

Raises the Changed event, notifying subscribers of completed collection modification.

Declaration
protected virtual void OnChanged(SheetCollectionChangedEventArgs args)
Parameters
SheetCollectionChangedEventArgs args

The SheetCollectionChangedEventArgs instance containing the event data.

Remove()

Removes the currently active sheet from the collection, ensuring at least one visible sheet remains.

Declaration
public void Remove()

Remove(String)

Removes the sheet with the specified name and returns true if found, false otherwise.

Declaration
public bool Remove(string sheetName)
Parameters
System.String sheetName

The name of the sheet.

Returns
System.Boolean

The value indicating whether a sheet with a specified name was found.

Remove(Sheet)

Removes the specified sheet from the collection and returns true if found, false otherwise.

Declaration
public bool Remove(Sheet sheet)
Parameters
Sheet sheet

The sheet.

Returns
System.Boolean

The value indicating whether the specified sheet was found.

RemoveAt(Int32)

Removes the sheet at the specified index, ensuring at least one visible sheet remains.

Declaration
public void RemoveAt(int index)
Parameters
System.Int32 index

The index.

Unhide(Int32)

Makes the sheet at the specified index visible and sets it as the active sheet.

Declaration
public void Unhide(int index)
Parameters
System.Int32 index

The index.

Unhide(Sheet)

Makes the specified sheet visible and sets it as the active sheet.

Declaration
public void Unhide(Sheet sheet)
Parameters
Sheet sheet

The sheet.

Events

ActiveSheetChanged

Raised when the active sheet reference changes, allowing UI to switch displayed content.

Declaration
public event EventHandler ActiveSheetChanged
Event Type
System.EventHandler

ActiveSheetIndexChanged

Raised when the active sheet's index changes, allowing UI to update tab selection.

Declaration
public event EventHandler ActiveSheetIndexChanged
Event Type
System.EventHandler

Changed

Raised after a sheet operation completes (add, remove, hide, unhide, move, clear), providing change details.

Declaration
public event EventHandler<SheetCollectionChangedEventArgs> Changed
Event Type
System.EventHandler<SheetCollectionChangedEventArgs>

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns a non-generic enumerator for iterating through all sheets in order.

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
System.Collections.IEnumerator

An System.Collections.IEnumerator object that can be used to iterate through the collection.

Implements
System.Collections.IEnumerable.GetEnumerator()

Extension Methods

CommonExtensions.ContainsAny<T>(IEnumerable<T>, IEnumerable<T>)
CommonExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
CommonExtensions.Clone<T>(IEnumerable<T>)
ExtensionMethodsEditor.CastCovariant<TFrom, TTo>(IEnumerable<TFrom>)
SvgExtentions.Traverse<T>(IEnumerable<T>, Func<T, IEnumerable<T>>)
SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(IEnumerable<T>, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.