Class ExcelWorksheet¶
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Represents an Excel worksheet and provides access to its properties and methods
Inheritance¶
object ← XmlHelper ← ExcelWorksheet
Derived¶
Implements¶
IDisposable
IEqualityComparer<ExcelWorksheet>
Inherited Members¶
object.Equals(object?, object?)
object.Equals(object?)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object?, object?)
object.ToString()
Extension Methods¶
CalculationExtension.Calculate(ExcelWorksheet, Action<ExcelCalculationOption>)
CalculationExtension.Calculate(ExcelWorksheet, ExcelCalculationOption)
CalculationExtension.Calculate(ExcelWorksheet, string, ExcelCalculationOption)
CalculationExtension.Calculate(ExcelWorksheet, string)
CalculationExtension.Calculate(ExcelWorksheet)
Constructors¶
ExcelWorksheet(XmlNamespaceManager, ExcelPackage, string, Uri, string, int, int, eWorkSheetHidden?)¶
A worksheet
public ExcelWorksheet(XmlNamespaceManager ns, ExcelPackage excelPackage, string relID, Uri uriWorksheet, string sheetName, int sheetID, int positionID, eWorkSheetHidden? hide)
Parameters¶
ns XmlNamespaceManager
Namespacemanager
excelPackage ExcelPackage
Package
relID string
Relationship ID
uriWorksheet Uri
URI
sheetName string
Name of the sheet
sheetID int
Sheet id
positionID int
Position
hide eWorkSheetHidden?
hide
Properties¶
AutoFilter¶
Autofilter settings
Property Value¶
BackgroundImage¶
An image displayed as the background of the worksheet.
Property Value¶
Cells¶
Provides access to a range of cells
Property Value¶
CodeModule¶
The VBA code modul for the worksheet, if the package contains a VBA project. CreateVBAProject
Property Value¶
Columns¶
A collection of column specific properties in the worksheet.
Property Value¶
Comments¶
Collection of comments
Property Value¶
ConditionalFormatting¶
ConditionalFormatting defined in the worksheet. Use the Add methods to create ConditionalFormatting and add them to the worksheet. Then set the properties on the instance returned.
Property Value¶
ExcelConditionalFormattingCollection
See Also¶
ExcelConditionalFormattingCollection
CustomHeight¶
'True' if defaultRowHeight value has been manually set, or is different from the default value. Is automaticlly set to 'True' when assigning the DefaultRowHeight property
Property Value¶
DataValidations¶
DataValidation defined in the worksheet. Use the Add methods to create DataValidations and add them to the worksheet. Then set the properties on the instance returned. Must know worksheet or at least worksheet name to determine if extLst when user input DataValidations in API.
Property Value¶
See Also¶
DefaultColWidth¶
Get/set the default width of all columns in the worksheet
Property Value¶
DefaultRowHeight¶
Get/set the default height of all rows in the worksheet
Property Value¶
Dimension¶
Dimension address for the worksheet for cells with a value or a style set. Top left cell to Bottom right. If the worksheet has no cells, null is returned
Property Value¶
DimensionByValue¶
Dimension address for the worksheet for cells with a value different than null. Top left cell to Bottom right. If the worksheet has no cells, null is returned
Property Value¶
Drawings¶
Collection of drawing-objects like shapes, images and charts
Property Value¶
FirstValueCell¶
The first cell with a value in the worksheet that differs from null. Normally this is the top-left cell, unless the worksheet is set to RightToLeft mode. RightToLeft
Property Value¶
HeaderFooter¶
A reference to the header and footer class which allows you to set the header and footer for all odd, even and first pages of the worksheet
Property Value¶
Remarks¶
To format the text you can use the following format
| Prefix | Description |
|---|---|
| &U | Underlined |
| &E | Double Underline |
| &K:xxxxxx | Color. ex &K:FF0000 for red |
| &"Font,Regular Bold Italic" | Changes the font. Regular or Bold or Italic or Bold Italic can be used. ex &"Arial,Bold Italic" |
| &nn | Change font size. nn is an integer. ex &24 |
| &G | Placeholder for images. Images cannot be added by the library, but its possible to use in a template. |
Hidden¶
Indicates if the worksheet is hidden in the workbook
Property Value¶
IgnoredErrors¶
Ignore Errors for the specified ranges and error types.
Property Value¶
Index¶
The index in the worksheets collection
Property Value¶
LastValueCell¶
The last cell with a value in the worksheet that differs from null. Normally this is the bottom-right cell, unless the worksheet is set to RightToLeft mode. RightToLeft
Property Value¶
MergedCells¶
Addresses to merged ranges
Property Value¶
ExcelWorksheet.MergeCellsCollection
Name¶
The worksheet's display name as it appears on the tab
Property Value¶
Names¶
Provides access to named ranges
Property Value¶
OutLineApplyStyle¶
Automatic styles
Property Value¶
OutLineSummaryBelow¶
If true, summary rows are showen below the details, otherwise above.
Property Value¶
OutLineSummaryRight¶
If true, summary columns are to right of details otherwise to the left.
Property Value¶
PivotTables¶
Pivot tables defined in the worksheet.
Property Value¶
PrinterSettings¶
Printer settings
Property Value¶
ProtectedRanges¶
Access to protected ranges in the worksheet
Property Value¶
Protection¶
Access to sheet protection properties
Property Value¶
QueryTables¶
A collection of query tables associated with the worksheet. These query tables are considered legacy and are used in older versions of Excel. Please consider to use AddQueryTable(ExcelAddressBase, string, ExcelConnection, string[]) instead.
Property Value¶
Remarks¶
Query tables are data tables that are linked to external data sources, such as databases or web queries.
RowZeroHeight¶
If true, empty rows are hidden by default. This reduces the size of the package and increases performance if most of the rows in a worksheet are hidden.
Property Value¶
Rows¶
A collection of row specific properties in the worksheet.
Property Value¶
SelectedRange¶
Provides access to the selected range of cells
Property Value¶
SignatureLines¶
Collection of signatureLines
Property Value¶
SortState¶
Sets the sort state
Property Value¶
SparklineGroups¶
Collection of Sparkline-objects. Sparklines are small in-cell charts.
Property Value¶
TabColor¶
Color of the sheet tab. To remove color, set TabColor to Color.Empty.
Property Value¶
Tables¶
Tables defined in the worksheet.
Property Value¶
ThreadedComments¶
A collection of threaded comments referenced in the worksheet.
Property Value¶
ExcelWorksheetThreadedComments
View¶
Returns a ExcelWorksheetView object that allows you to set the view state properties of the worksheet
Property Value¶
Workbook¶
The workbook object
Property Value¶
WorksheetXml¶
The XML document holding the worksheet data. All column, row, cell, pagebreak, merged cell and hyperlink-data are loaded into memory and removed from the document when loading the document.
Property Value¶
XmlDocument
Methods¶
ClearFormulaValues()¶
Removes all values of cells with formulas in the entire worksheet, but keeps the formulas.
ClearFormulas()¶
Removes all formulas within the entire worksheet, but keeps the calculated values.
Column(int)¶
Provides access to an individual column within the worksheet so you can set its properties.
Parameters¶
col int
The column number in the worksheet
Returns¶
DeleteColumn(int)¶
Delete the specified column from the worksheet.
Parameters¶
column int
The column to be deleted
DeleteColumn(int, int)¶
Delete the specified columns from the worksheet.
Parameters¶
columnFrom int
The start column
columns int
Number of columns to delete
DeleteRow(int)¶
Delete the specified row from the worksheet.
Parameters¶
row int
A row to be deleted
DeleteRow(int, int)¶
Delete the specified rows from the worksheet.
Parameters¶
rowFrom int
The start row
rows int
Number of rows to delete
Dispose()¶
Disposes the worksheet
Equals(ExcelWorksheet, ExcelWorksheet)¶
Check if a worksheet is equal to another
Parameters¶
First worksheet
Second worksheet
Returns¶
GetFormulaRange(int, int)¶
Gets the range for the formula in the cell. A shared formula will return the range for the entire series. An array formula will return the range of the output of the formula. If you want the range of a dynamic array formula, you must calculate the formula first.
Parameters¶
row int
The row of the cell containing the formula.
column int
The column of the cell containing the formula.
Returns¶
The range the formula spans
GetHashCode(ExcelWorksheet)¶
Returns a hashcode generated from the WorksheetXml
Parameters¶
obj ExcelWorksheet
The worksheet
Returns¶
The hashcode
GetMergeCellId(int, int)¶
Get MergeCell Index No
Parameters¶
row int
column int
Returns¶
GetValue(int, int)¶
Get the cell value from the worksheet
Parameters¶
Row int
The row number
Column int
The row number
Returns¶
The value
GetValue<T>(int, int)¶
Get a strongly typed cell value from the worksheet
Parameters¶
Row int
The row number
Column int
The row number
Returns¶
T
The value. If the value can't be converted to the specified type, the default value will be returned
Type Parameters¶
T
The type
InsertColumn(int, int)¶
Inserts new columns into the spreadsheet. Existing columns below the position are shifted down. All formula are updated to take account of the new column(s).
Parameters¶
columnFrom int
The position of the new column(s)
columns int
Number of columns to insert
InsertColumn(int, int, int)¶
Inserts new columns into the spreadsheet. Existing column to the left are shifted. All formula are updated to take account of the new column(s).
Parameters¶
columnFrom int
The position of the new column(s)
columns int
Number of columns to insert.
copyStylesFromColumn int
Copy Styles from this column. Applied to all inserted columns
InsertRow(int, int)¶
Inserts new rows into the spreadsheet. Existing rows below the position are shifted down. All formula are updated to take account of the new row(s).
Parameters¶
rowFrom int
The position of the new row(s)
rows int
Number of rows to insert
InsertRow(int, int, int)¶
Inserts new rows into the spreadsheet. Existing rows below the position are shifted down. All formula are updated to take account of the new row(s).
Parameters¶
rowFrom int
The position of the new row(s)
rows int
Number of rows to insert.
copyStylesFromRow int
Copy Styles from this row. Applied to all inserted rows
Row(int)¶
Provides access to an individual row within the worksheet so you can set its properties.
Parameters¶
row int
The row number in the worksheet
Returns¶
Select()¶
Make the current worksheet active.
Select(string)¶
Selects a range in the worksheet. The active cell is the topmost cell. Make the current worksheet active.
Parameters¶
Address string
An address range
Select(string, bool)¶
Selects a range in the worksheet. The actice cell is the topmost cell.
Parameters¶
Address string
A range of cells
SelectSheet bool
Make the sheet active
Select(ExcelAddress)¶
Selects a range in the worksheet. The active cell is the topmost cell of the first address. Make the current worksheet active.
Parameters¶
Address ExcelAddress
An address range
Select(ExcelAddress, bool)¶
Selects a range in the worksheet. The active cell is the topmost cell of the first address.
Parameters¶
Address ExcelAddress
A range of cells
SelectSheet bool
Make the sheet active
SetValue(int, int, object)¶
Set the value of a cell
Parameters¶
Row int
The row number
Column int
The column number
Value object
The value
SetValue(string, object)¶
Set the value of a cell
Parameters¶
Address string
The Excel address
Value object
The value
ToString()¶
Returns the name of the worksheet
Returns¶
The name of the worksheet