The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

WorksheetCollection Interface

A collection of worksheets contained in a workbook.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

public interface WorksheetCollection :
    ISimpleCollection<Worksheet>,
    IEnumerable<Worksheet>,
    IEnumerable,
    ICollection
Public Interface WorksheetCollection
    Inherits ISimpleCollection(Of Worksheet),
             IEnumerable(Of Worksheet),
             IEnumerable,
             ICollection
public interface WorksheetCollection :
    ISimpleCollection<Worksheet>,
    IEnumerable<Worksheet>,
    IEnumerable,
    ICollection
Public Interface WorksheetCollection
    Inherits ISimpleCollection(Of Worksheet),
             IEnumerable(Of Worksheet),
             IEnumerable,
             ICollection

Remarks

The WorksheetCollection object stores worksheets of the workbook (a workbook always contains at least one worksheet). Use the IWorkbook.Worksheets property to access this object. The WorksheetCollection.Item property enables you to get an individual worksheet by its name or index in the collection.

To add a new worksheet to the workbook, use the WorksheetCollection.Add or WorksheetCollection.Insert method. To remove a worksheet from the workbook, use the WorksheetCollection.Remove or WorksheetCollection.RemoveAt method.

For details on how to manage worksheets in a workbook, refer to the Worksheets section of examples.

Examples

This example demonstrates how to access worksheets in a workbook. Use the IWorkbook.Worksheets property to get a collection of worksheets contained in a workbook (the WorksheetCollection object).

To get an individual worksheet by its index or name, use the WorksheetCollection.Item property.

using DevExpress.Spreadsheet;
// ...

IWorkbook workbook = spreadsheetControl1.Document;

// Access a collection of worksheets.
WorksheetCollection worksheets = workbook.Worksheets;

// Access a worksheet by its index.
Worksheet worksheet1 = workbook.Worksheets[0];

// Access a worksheet by its name.
Worksheet worksheet2 = workbook.Worksheets["Sheet2"];
See Also