• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class WorksheetCollection

Represents a collection of worksheets in a workbook.

Inheritance
object
WorksheetCollection
Implements
IEnumerable<Worksheet>
IEnumerable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class WorksheetCollection : IEnumerable<Worksheet>, IEnumerable
Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

Properties

Count

Reports the number of items currently held by WorksheetCollection.

Declaration
public int Count { get; }
Property Value
Type Description
int

The count returned by the operation.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

this[int]

Provides indexed access to values in the WorksheetCollection.

Declaration
public Worksheet this[int index] { get; }
Parameters
Type Name Description
int index
Property Value
Type Description
Worksheet

The this returned by the operation.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

this[string]

Provides indexed access to values in the WorksheetCollection.

Declaration
public Worksheet this[string name] { get; }
Parameters
Type Name Description
string name
Property Value
Type Description
Worksheet

The this returned by the operation.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

Methods

Add()

Adds the supplied item to the WorksheetCollection.

Declaration
public Worksheet Add()
Returns
Type Description
Worksheet

The add returned by the operation.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

Add(string)

Adds the supplied item to the WorksheetCollection.

Declaration
public Worksheet Add(string name)
Parameters
Type Name Description
string name

The name used by the operation.

Returns
Type Description
Worksheet

The add returned by the operation.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

AddCopy(Worksheet)

Adds a copy of the specified worksheet to this collection.

Declaration
public Worksheet AddCopy(Worksheet worksheet)
Parameters
Type Name Description
Worksheet worksheet

The source worksheet to copy.

Returns
Type Description
Worksheet

The copied worksheet.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

AddCopy(string, Worksheet)

Adds a copy of the specified worksheet to this collection with the provided name.

Declaration
public Worksheet AddCopy(string name, Worksheet worksheet)
Parameters
Type Name Description
string name

The name of the copied worksheet.

Worksheet worksheet

The source worksheet to copy.

Returns
Type Description
Worksheet

The copied worksheet.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

GetEnumerator()

Returns an enumerator that iterates through the collection of worksheets.

Declaration
public IEnumerator<Worksheet> GetEnumerator()
Returns
Type Description
IEnumerator<Worksheet>

An enumerator for the worksheet collection.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

ImportCopy(Worksheet, string)

Adds a copy of sourceWorksheet to this collection. Unlike AddCopy(Worksheet), the source worksheet may belong to a different workbook; cell formatting is remapped onto this workbook's style sheet via DRIT.Spreadsheet.CellFormatting.CloneFor(DRIT.Spreadsheet.Workbook).

Declaration
public Worksheet ImportCopy(Worksheet sourceWorksheet, string name = null)
Parameters
Type Name Description
Worksheet sourceWorksheet

The source worksheet to copy. May belong to a different workbook.

string name

The name for the copied worksheet. When null, a name based on the source sheet name is generated. When the provided name collides with an existing sheet, a " Copy" suffix is appended.

Returns
Type Description
Worksheet

The copied worksheet.

Remarks

WorksheetCollection provides access to all worksheets in a workbook and supports adding new worksheets.

Implements

IEnumerable<T>
IEnumerable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX