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
this[int]
Returns the worksheet at the specified position.
public ExcelWorksheet this[int PositionID] { get; }
Parameters
PositionID
intThe position of the worksheet. Collection is zero-based or one-base depending on the Package.Compatibility.IsWorksheets1Based propery. Default is Zero based
Property Value
- See Also
this[string]
Returns the worksheet matching the specified name
public ExcelWorksheet this[string Name] { get; }
Parameters
Name
stringThe name of the worksheet
Property Value
Methods
Add(string)
Adds a new blank worksheet.
public ExcelWorksheet Add(string Name)
Parameters
Name
stringThe name of the workbook
Returns
Add(string, ExcelWorksheet)
Adds a copy of a worksheet
public ExcelWorksheet Add(string Name, ExcelWorksheet Copy)
Parameters
Name
stringThe name of the workbook
Copy
ExcelWorksheetThe worksheet to be copied
Returns
AddChart(string, eChartType)
Adds a chartsheet to the workbook.
public ExcelChartsheet AddChart(string Name, eChartType chartType)
Parameters
Name
stringThe name of the worksheet
chartType
eChartTypeThe type of chart
Returns
AddChart(string, eChartType, ExcelPivotTable)
Adds a chartsheet to the workbook.
public ExcelChartsheet AddChart(string Name, eChartType chartType, ExcelPivotTable pivotTableSource)
Parameters
Name
stringThe name of the worksheet
chartType
eChartTypeThe type of chart
pivotTableSource
ExcelPivotTableThe pivottable source
Returns
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
stringThe name of the worksheet
CategorySerie
ExcelRangeBaseThe category serie. A serie containing dates or names
HighSerie
ExcelRangeBaseThe high price serie
LowSerie
ExcelRangeBaseThe low price serie
CloseSerie
ExcelRangeBaseThe close price serie containing
OpenSerie
ExcelRangeBaseThe opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
VolumeSerie
ExcelRangeBaseThe volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart
Returns
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
stringThe name of the existing worksheet
NewName
stringThe 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
ExcelWorksheetThe worksheet to delete
Delete(int)
Deletes a worksheet from the collection
public void Delete(int Index)
Parameters
Index
intThe position of the worksheet in the workbook
Delete(string)
Deletes a worksheet from the collection
public void Delete(string name)
Parameters
name
stringThe 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
intThe id of the source worksheet
targetPositionId
intThe 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
stringThe name of the source worksheet
targetName
stringThe 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
intThe id of the source worksheet
targetPositionId
intThe 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
stringThe name of the source worksheet
targetName
stringThe 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
intThe 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
stringThe 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
intThe 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
stringThe name of the source worksheet