Table of Contents

Class ExcelWorksheets

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

The collection of worksheets for the workbook

public class ExcelWorksheets : XmlHelper, IEnumerable<ExcelWorksheet>, IEnumerable, IDisposable
Inheritance
ExcelWorksheets
Implements
Inherited Members

Properties

Count

Returns the number of worksheets in the workbook

public int Count { get; }

Property Value

int

this[int]

Returns the worksheet at the specified position.

public ExcelWorksheet this[int PositionID] { get; }

Parameters

PositionID int

The position of the worksheet. Collection is zero-based or one-base depending on the Package.Compatibility.IsWorksheets1Based propery. Default is Zero based

Property Value

ExcelWorksheet
See Also

this[string]

Returns the worksheet matching the specified name

public ExcelWorksheet this[string Name] { get; }

Parameters

Name string

The name of the worksheet

Property Value

ExcelWorksheet

Methods

Add(string)

Adds a new blank worksheet.

public ExcelWorksheet Add(string Name)

Parameters

Name string

The name of the workbook

Returns

ExcelWorksheet

Add(string, ExcelWorksheet)

Adds a copy of a worksheet

public ExcelWorksheet Add(string Name, ExcelWorksheet Copy)

Parameters

Name string

The name of the workbook

Copy ExcelWorksheet

The worksheet to be copied

Returns

ExcelWorksheet

AddChart(string, eChartType)

Adds a chartsheet to the workbook.

public ExcelChartsheet AddChart(string Name, eChartType chartType)

Parameters

Name string

The name of the worksheet

chartType eChartType

The type of chart

Returns

ExcelChartsheet

AddChart(string, eChartType, ExcelPivotTable)

Adds a chartsheet to the workbook.

public ExcelChartsheet AddChart(string Name, eChartType chartType, ExcelPivotTable pivotTableSource)

Parameters

Name string

The name of the worksheet

chartType eChartType

The type of chart

pivotTableSource ExcelPivotTable

The pivottable source

Returns

ExcelChartsheet

AddStockChart(string, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase)

Adds a stock chart sheet to the workbook.

public ExcelChartsheet AddStockChart(string Name, ExcelRangeBase CategorySerie, ExcelRangeBase HighSerie, ExcelRangeBase LowSerie, ExcelRangeBase CloseSerie, ExcelRangeBase OpenSerie = null, ExcelRangeBase VolumeSerie = null)

Parameters

Name string

The name of the worksheet

CategorySerie ExcelRangeBase

The category serie. A serie containing dates or names

HighSerie ExcelRangeBase

The high price serie

LowSerie ExcelRangeBase

The low price serie

CloseSerie ExcelRangeBase

The close price serie containing

OpenSerie ExcelRangeBase

The opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart

VolumeSerie ExcelRangeBase

The volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart

Returns

ExcelChartsheet

Copy(string, string)

Copies the named worksheet and creates a new worksheet in the same workbook

public ExcelWorksheet Copy(string Name, string NewName)

Parameters

Name string

The name of the existing worksheet

NewName string

The name of the new worksheet to create

Returns

ExcelWorksheet

The new copy added to the end of the worksheets collection

Delete(ExcelWorksheet)

Delete a worksheet from the collection

public void Delete(ExcelWorksheet Worksheet)

Parameters

Worksheet ExcelWorksheet

The worksheet to delete

Delete(int)

Deletes a worksheet from the collection

public void Delete(int Index)

Parameters

Index int

The position of the worksheet in the workbook

Delete(string)

Deletes a worksheet from the collection

public void Delete(string name)

Parameters

name string

The name of the worksheet in the workbook

Dispose()

Dispose the worksheets collection

public void Dispose()

GetEnumerator()

Foreach support

public IEnumerator<ExcelWorksheet> GetEnumerator()

Returns

IEnumerator<ExcelWorksheet>

An enumerator

MoveAfter(int, int)

Moves the source worksheet to the position after the target worksheet

public void MoveAfter(int sourcePositionId, int targetPositionId)

Parameters

sourcePositionId int

The id of the source worksheet

targetPositionId int

The id of the target worksheet

MoveAfter(string, string)

Moves the source worksheet to the position after the target worksheet

public void MoveAfter(string sourceName, string targetName)

Parameters

sourceName string

The name of the source worksheet

targetName string

The name of the target worksheet

MoveBefore(int, int)

Moves the source worksheet to the position before the target worksheet

public void MoveBefore(int sourcePositionId, int targetPositionId)

Parameters

sourcePositionId int

The id of the source worksheet

targetPositionId int

The id of the target worksheet

MoveBefore(string, string)

Moves the source worksheet to the position before the target worksheet

public void MoveBefore(string sourceName, string targetName)

Parameters

sourceName string

The name of the source worksheet

targetName string

The name of the target worksheet

MoveToEnd(int)

Moves the source worksheet to the end of the worksheets collection

public void MoveToEnd(int sourcePositionId)

Parameters

sourcePositionId int

The position of the source worksheet

MoveToEnd(string)

Moves the source worksheet to the end of the worksheets collection

public void MoveToEnd(string sourceName)

Parameters

sourceName string

The name of the source worksheet

MoveToStart(int)

Moves the source worksheet to the start of the worksheets collection

public void MoveToStart(int sourcePositionId)

Parameters

sourcePositionId int

The position of the source worksheet

MoveToStart(string)

Moves the source worksheet to the start of the worksheets collection

public void MoveToStart(string sourceName)

Parameters

sourceName string

The name of the source worksheet