Click or drag to resize
PicoXLSX

Worksheet Class

Class representing a worksheet of a workbook
Inheritance Hierarchy
SystemObject
  PicoXLSXWorksheet

Namespace: PicoXLSX
Assembly: PicoXLSX (in PicoXLSX.dll) Version: 3.2.1+e0edc719a6aeecf6c989e5a57750c75d6f3175bb
Syntax
C#
public class Worksheet

The Worksheet type exposes the following members.

Constructors
 NameDescription
Private methodStatic memberWorksheet 
Public methodWorksheet Initializes a new instance of the Worksheet class
Public methodWorksheet(String) Initializes a new instance of the Worksheet class
Public methodWorksheet(String, Int32, Workbook) Initializes a new instance of the Worksheet class
Top
Properties
 NameDescription
Public propertyActivePane Gets the active Pane is splitting is applied.
The value is nullable. If null, no splitting was defined
Public propertyActiveStyle Gets the active Style of the worksheet. If null, no style is defined as active
Public propertyAutoFilterRange Gets the range of the auto-filter. Wrapped to Nullable to provide null as value. If null, no auto-filter is applied
Public propertyCells Gets the cells of the worksheet as dictionary with the cell address as key and the cell object as value
Public propertyColumns Gets all columns with non-standard properties, like auto filter applied or a special width as dictionary with the zero-based column index as key and the column object as value
Public propertyCurrentCellDirection Gets or sets the direction when using AddNextCell method
Public propertyDefaultColumnWidth Gets or sets the default column width
Public propertyDefaultRowHeight Gets or sets the default Row height
Public propertyFreezeSplitPanes Gets the FreezeSplitPanes Gets whether split panes are frozen.
The value is nullable. If null, no freezing is applied. This property also does not apply if PaneSplitAddress is null
Public propertyHidden Gets or sets whether the worksheet is hidden. If true, the worksheet is not listed as tab in the workbook's worksheet selection
If the worksheet is not part of a workbook, or the only one in the workbook, an exception will be thrown.
If the worksheet is the selected one, and attempted to set hidden, an exception will be thrown. Define another selected worksheet prior to this call, in this case.
Public propertyHiddenRows Gets the hidden rows as dictionary with the zero-based row number as key and a boolean as value. True indicates hidden, false visible.
Public propertyMergedCells Gets the merged cells (only references) as dictionary with the cell address as key and the range object as value
Public propertyPaneSplitAddress Gets the split address for frozen panes or if pane split was defined in number of columns and / or rows.
For vertical splits, only the column component is considered. For horizontal splits, only the row component is considered.
The value is nullable. If null, no frozen panes or split by columns / rows are applied to the worksheet. However, splitting can still be applied, if the value is defined in characters.
See also: PaneSplitLeftWidth and PaneSplitTopHeight for splitting in characters (without freezing)
Public propertyPaneSplitLeftWidth Gets the width of the left, vertical split pane, measured from the left of the window.
The value is nullable. If null, no vertical split of the worksheet is applied
The value is only applicable to split the worksheet into panes, but not to freeze them.
See also: PaneSplitAddress
Public propertyPaneSplitTopHeight Gets the height of the upper, horizontal split pane, measured from the top of the window.
The value is nullable. If null, no horizontal split of the worksheet is applied.
The value is only applicable to split the worksheet into panes, but not to freeze them.
See also: PaneSplitAddress
Public propertyPaneSplitTopLeftCell Gets the Top Left cell address of the bottom right pane if applicable and splitting is applied.
The column is only relevant for vertical split, whereas the row component is only relevant for a horizontal split.
The value is nullable. If null, no splitting was defined.
Public propertyRowHeights Gets defined row heights as dictionary with the zero-based row number as key and the height (float from 0 to 409.5) as value
Public propertySelectedCellRanges Gets all ranges of selected cells of this worksheet. An empty list is returned if no cells are selected
Public propertySelectedCellsObsolete.
Returns either null (if no cells are selected), or the first defined range of selected cells
Public propertySheetID Gets or sets the internal ID of the worksheet
Public propertySheetName Gets or sets the name of the worksheet
Public propertySheetProtectionPassword Gets the password used for sheet protection. See SetSheetProtectionPassword(String) to set the password
Public propertySheetProtectionPasswordHash gets the encrypted hash of the password, defined with SheetProtectionPassword. The value will be null, if no password is defined
Public propertySheetProtectionValues Gets the list of SheetProtectionValues. These values define the allowed actions if the worksheet is protected
Public propertyShowGridLines Gets or sets whether grid lines are visible on the current worksheet. Default is true
Public propertyShowRowColumnHeaders Gets or sets whether the column and row headers are visible on the current worksheet. Default is true
Public propertyShowRuler Gets or sets whether a ruler is displayed over the column headers. This value only applies if ViewType is set to pageLayout. Default is true
Public propertyUseSheetProtection Gets or sets whether the worksheet is protected. If true, protection is enabled
Public propertyViewType Gets or sets how the current worksheet is displayed in the spreadsheet application (Excel)
Public propertyWorkbookReference Gets or sets the Reference to the parent Workbook
Public propertyZoomFactor Gets or sets the zoom factor of the ViewType of the current worksheet. If AUTO_ZOOM_FACTOR, the zoom factor is set to automatic
Public propertyZoomFactors Gets all defined zoom factors per WorksheetSheetViewType of the current worksheet. Use SetZoomFactor(WorksheetSheetViewType, Int32) to define the values
Top
Methods
 NameDescription
Public methodAddAllowedActionOnSheetProtection Method to add allowed actions if the worksheet is protected. If one or more values are added, UseSheetProtection will be set to true
Public methodAddCell(Object, String) Adds an object to the defined cell address. If the type of the value does not match with one of the supported data types, it will be casted to a String. A prepared object of the type Cell will not be casted but adjusted
Public methodAddCell(Object, Int32, Int32) Adds an object to the defined cell address. If the type of the value does not match with one of the supported data types, it will be casted to a String. A prepared object of the type Cell will not be casted but adjusted
Public methodAddCell(Object, String, Style) Adds an object to the defined cell address. If the type of the value does not match with one of the supported data types, it will be casted to a String. A prepared object of the type Cell will not be casted but adjusted
Public methodAddCell(Object, Int32, Int32, Style) Adds an object to the defined cell address. If the type of the value does not match with one of the supported data types, it will be casted to a String. A prepared object of the type Cell will not be casted but adjusted
Public methodAddCellFormula(String, String) Adds a cell formula as string to the defined cell address
Public methodAddCellFormula(String, Int32, Int32) Adds a cell formula as string to the defined cell address
Public methodAddCellFormula(String, String, Style) Adds a cell formula as string to the defined cell address
Public methodAddCellFormula(String, Int32, Int32, Style) Adds a cell formula as string to the defined cell address
Public methodAddCellRange(IReadOnlyListObject, String) Adds a list of object values to a defined cell range. If the type of the a particular value does not match with one of the supported data types, it will be casted to a String. Prepared objects of the type Cell will not be casted but adjusted
Public methodAddCellRange(IReadOnlyListObject, CellAddress, CellAddress) Adds a list of object values to a defined cell range. If the type of the a particular value does not match with one of the supported data types, it will be casted to a String. Prepared objects of the type Cell will not be casted but adjusted
Public methodAddCellRange(IReadOnlyListObject, String, Style) Adds a list of object values to a defined cell range. If the type of the a particular value does not match with one of the supported data types, it will be casted to a String. Prepared objects of the type Cell will not be casted but adjusted
Public methodAddCellRange(IReadOnlyListObject, CellAddress, CellAddress, Style) Adds a list of object values to a defined cell range. If the type of the a particular value does not match with one of the supported data types, it will be casted to a String. Prepared objects of the type Cell will not be casted but adjusted
Private methodAddCellRangeInternalT Internal function to add a generic list of value to the defined cell range
Public methodAddHiddenColumn(Int32) Sets the defined column as hidden
Public methodAddHiddenColumn(String) Sets the defined column as hidden
Public methodAddHiddenRow Sets the defined row as hidden
Public methodAddNextCell(Object) Adds an object to the next cell position. If the type of the value does not match with one of the supported data types, it will be casted to a String. A prepared object of the type Cell will not be casted but adjusted
Public methodAddNextCell(Object, Style) Adds an object to the next cell position. If the type of the value does not match with one of the supported data types, it will be casted to a String. A prepared object of the type Cell will not be casted but adjusted
Private methodAddNextCell(Cell, Boolean, Style) Method to insert a generic cell to the next cell position
Public methodAddNextCellFormula(String) Adds a formula as string to the next cell position
Public methodAddNextCellFormula(String, Style) Adds a formula as string to the next cell position
Public methodAddSelectedCells(CellRange) Adds a range to the selected cells on this worksheet
Public methodAddSelectedCells(String) Adds a range to the selected cells on this worksheet. Null or empty as value will be ignored
Public methodAddSelectedCells(CellAddress, CellAddress) Adds a range to the selected cells on this worksheet
Private methodCastValue Method to cast a value or align an object of the type Cell to the context of the worksheet
Public methodClearActiveStyle Clears the active style of the worksheet. All later added calls will contain no style unless another active style is set
Public methodCopy Creates a (dereferenced) deep copy of this worksheet
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Private methodGetBoundaryDataNumber Gets either the minimum or maximum row or column number, considering only calls with data
Private methodGetBoundaryNumber Gets either the minimum or maximum row or column number, considering all available data
Public methodGetCell(CellAddress) Gets the cell of the specified address
Public methodGetCell(Int32, Int32) Gets the cell of the specified column and row number (zero-based)
Public methodGetCurrentColumnNumber Gets the current column number (zero based)
Public methodGetCurrentRowNumber Gets the current row number (zero based)
Public methodGetFirstCellAddress Gets the first existing cell in the current worksheet (bottom right)
Public methodGetFirstColumnNumber Gets the first existing column number in the current worksheet (zero-based)
Public methodGetFirstDataCellAddress Gets the first existing cell with data in the current worksheet (bottom right)
Public methodGetFirstDataColumnNumber Gets the first existing column number with data in the current worksheet (zero-based)
Public methodGetFirstDataRowNumber Gets the first existing row number with data in the current worksheet (zero-based)
Public methodGetFirstRowNumber Gets the first existing row number in the current worksheet (zero-based)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLastCellAddress Gets the last existing cell in the current worksheet (bottom right)
Public methodGetLastColumnNumber Gets the last existing column number in the current worksheet (zero-based)
Public methodGetLastDataCellAddress Gets the last existing cell with data in the current worksheet (bottom right)
Public methodGetLastDataColumnNumber Gets the last existing column number with data in the current worksheet (zero-based)
Public methodGetLastDataRowNumber Gets the last existing row number with data in the current worksheet (zero-based)
Public methodGetLastRowNumber Gets the last existing row number in the current worksheet (zero-based)
Private methodGetMaxRow Gets the maximum row coordinate either from cell data, height definitions or hidden rows
Private methodGetMinRow Gets the minimum row coordinate either from cell data, height definitions or hidden rows
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Private methodStatic memberGetUnusedWorksheetName Determines the next unused worksheet name in the passed workbook
Public methodGoToNextColumn Moves the current position to the next column
Public methodGoToNextColumn(Int32, Boolean) Moves the current position to the next column with the number of cells to move
Public methodGoToNextRow Moves the current position to the next row (use for a new line)
Public methodGoToNextRow(Int32, Boolean) Moves the current position to the next row with the number of cells to move (use for a new line)
Public methodHasCell(CellAddress) Gets whether the specified address exists in the worksheet. Existing means that a value was stored at the address
Public methodHasCell(Int32, Int32) Gets whether the specified address exists in the worksheet. Existing means that a value was stored at the address
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodMergeCells(CellRange) Merges the defined cell range
Public methodMergeCells(String) Merges the defined cell range
Public methodMergeCells(CellAddress, CellAddress) Merges the defined cell range
Protected methodRecalculateAutoFilter Method to recalculate the auto filter (columns) of this worksheet. This is an internal method. There is no need to use it
Protected methodRecalculateColumns Method to recalculate the collection of columns of this worksheet. This is an internal method. There is no need to use it
Public methodRemoveAllowedActionOnSheetProtection Removes an allowed action on the current worksheet or its cells
Public methodRemoveAutoFilter Removes auto filters from the worksheet
Public methodRemoveCell(String) Removes a previous inserted cell at the defined address
Public methodRemoveCell(Int32, Int32) Removes a previous inserted cell at the defined address
Public methodRemoveHiddenColumn(Int32) Sets a previously defined, hidden column as visible again
Public methodRemoveHiddenColumn(String) Sets a previously defined, hidden column as visible again
Public methodRemoveHiddenRow Sets a previously defined, hidden row as visible again
Public methodRemoveMergedCells Removes the defined merged cell range
Public methodRemoveRowHeight Removes the defined, non-standard row height
Public methodRemoveSelectedCells Removes the cell selection of this worksheet
Public methodResetColumn Resets the defined column, if existing. The corresponding instance will be removed from Columns
Public methodResetSplit Resets splitting of the worksheet into panes, as well as their freezing
Protected methodResolveMergedCells Method to resolve all merged cells of the worksheet. Only the value of the very first cell of the locked cells range will be visible. The other values are still present (set to EMPTY) but will not be stored in the worksheet.
This is an internal method. There is no need to use it
Public methodStatic memberSanitizeWorksheetName Sanitizes a worksheet name
Public methodSetActiveStyle Sets the active style of the worksheet. This style will be assigned to all later added cells
Public methodSetAutoFilter(String) Sets the column auto filter within the defined column range
Public methodSetAutoFilter(Int32, Int32) Sets the column auto filter within the defined column range
Private methodSetColumnHiddenState Sets the defined column as hidden or visible
Public methodSetColumnWidth(Int32, Single) Sets the width of the passed column number (zero-based)
Public methodSetColumnWidth(String, Single) Sets the width of the passed column address
Public methodSetCurrentCellAddress(String) Set the current cell address
Public methodSetCurrentCellAddress(Int32, Int32) Set the current cell address
Public methodSetCurrentColumnNumber Sets the current column number (zero based)
Public methodSetCurrentRowNumber Sets the current row number (zero based)
Public methodSetHorizontalSplit(Single, CellAddress, WorksheetWorksheetPane) Sets the horizontal split of the worksheet into two panes. The measurement in characters cannot be used to freeze panes
Public methodSetHorizontalSplit(Int32, Boolean, CellAddress, WorksheetWorksheetPane) Sets the horizontal split of the worksheet into two panes. The measurement in rows can be used to split and freeze panes
Public methodSetRowHeight Sets the height of the passed row number (zero-based)
Private methodSetRowHiddenState Sets the defined row as hidden or visible
Public methodSetSelectedCells(CellRange)Obsolete.
Sets a single range of selected cells on this worksheet. All existing ranges will be removed
Public methodSetSelectedCells(String)Obsolete.
Sets a single range of selected cells on this worksheet. All existing ranges will be removed. Null will remove all selected cells
Public methodSetSelectedCells(CellAddress, CellAddress)Obsolete.
Sets the selected cells on this worksheet
Public methodSetSheetName(String) Validates and sets the worksheet name
Public methodSetSheetName(String, Boolean) Sets the name of the worksheet
Public methodSetSheetProtectionPassword Sets or removes the password for worksheet protection. If set, UseSheetProtection will be also set to true
Public methodSetSplit(NullableSingle, NullableSingle, CellAddress, WorksheetWorksheetPane) Sets the horizontal and vertical split of the worksheet into four panes. The measurement in characters cannot be used to freeze panes
Public methodSetSplit(NullableInt32, NullableInt32, Boolean, CellAddress, WorksheetWorksheetPane) Sets the horizontal and vertical split of the worksheet into four panes. The measurement in rows and columns can be used to split and freeze panes
Public methodSetStyle(CellAddress, Style) Sets the passed style on the passed (singular) cell address. If the cell is already existing, the style will be added or replaced Sets the passed style on the passed (singular) cell address. If the cell is already existing, the style will be added or replaced
Public methodSetStyle(CellRange, Style) Sets the passed style on the passed cell range. If cells are already existing, the style will be added or replaced
Public methodSetStyle(String, Style) Sets the passed style on the passed address expression. Such an expression may be a single cell or a cell range Sets the passed style on the passed address expression. Such an expression may be a single cell or a cell range Sets the passed style on the passed address expression. Such an expression may be a single cell or a cell range
Public methodSetStyle(CellAddress, CellAddress, Style) Sets the passed style on the passed cell range, derived from a start and end address. If cells are already existing, the style will be added or replaced Sets the passed style on the passed cell range, derived from a start and end address. If cells are already existing, the style will be added or replaced
Public methodSetVerticalSplit(Single, CellAddress, WorksheetWorksheetPane) Sets the vertical split of the worksheet into two panes. The measurement in characters cannot be used to freeze panes
Public methodSetVerticalSplit(Int32, Boolean, CellAddress, WorksheetWorksheetPane) Sets the vertical split of the worksheet into two panes. The measurement in columns can be used to split and freeze panes
Public methodSetZoomFactor Sets a zoom factor for a given WorksheetSheetViewType. If AUTO_ZOOM_FACTOR, the zoom factor is set to automatic
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Private methodStatic memberWorksheetExists Checks whether a worksheet with the given name exists
Top
Fields
 NameDescription
Public fieldStatic memberAUTO_ZOOM_FACTOR Automatic zoom factor of a worksheet
Public fieldStatic memberDEFAULT_COLUMN_WIDTH Default column width as constant
Public fieldStatic memberDEFAULT_ROW_HEIGHT Default row height as constant
Public fieldStatic memberMAX_COLUMN_NUMBER Maximum column number (zero-based) as constant
Public fieldStatic memberMAX_COLUMN_WIDTH Maximum column width as constant
Public fieldStatic memberMAX_ROW_HEIGHT Maximum row height as constant
Public fieldStatic memberMAX_ROW_NUMBER Maximum row number (zero-based) as constant
Public fieldStatic memberMAX_WORKSHEET_NAME_LENGTH Maximum number of characters a worksheet name can have
Public fieldStatic memberMAX_ZOOM_FACTOR Maximum zoom factor of a worksheet
Public fieldStatic memberMIN_COLUMN_NUMBER Minimum column number (zero-based) as constant
Public fieldStatic memberMIN_COLUMN_WIDTH Minimum column width as constant
Public fieldStatic memberMIN_ROW_HEIGHT Minimum row height as constant
Public fieldStatic memberMIN_ROW_NUMBER Minimum row number (zero-based) as constant
Public fieldStatic memberMIN_ZOOM_FACTOR Minimum zoom factor of a worksheet
Top
See Also