Description
A Cell object represents a single cell in a worksheet. To return a Cell
object use Worksheet.Cells. Specify the cell by 0-based row and column indexes or by Excel-style reference:
C#
vb.net
Examples
C#
vb.net
Properties
Name |
Description |
---|---|
Returns the cell's 0-based column number. | |
Returns a Comment object representing a note attached to the cell, separate from other cell content. If a comment is not associated with the specified cell, a new comment will be created and returned. | |
Returns the ConditionalFormat object associated with the current Cell. If a ConditionalFormat object does not exist, a new one will be created. Any changes made to the object returned will only affect this Cell . |
|
Returns the cell's DataValidation object if one exists. Otherwise, returns 'null'. | |
Sets or returns a cell formula. If no formula is associated with the cell, the property returns an empty string. | |
Returns true if a Comment object is associated with the cell. |
|
Returns whether or not the Cell contains a ConditionalFormat object. | |
Returns true if the cell has a DataValidation object associated with it. |
|
Returns whether or not the Cell is a merged cell. | |
Returns the cell's Excel-style name (such as, "B5"). | |
Returns the cell's 0-based row number. | |
Sets or returns a Style object that determines how the cell looks, including number format, font, orientation, etc. Accessing the cell's style through Cell.Style will not affect the formatting of other cells with the same global style. | |
Sets or returns a cell value. Empty cells will return either null or empty string. | |
Returns the data type of the cell's value: "Blank, "Boolean", "Date", "Error", "Numeric", or "Text". |
Methods
Name |
Description |
---|---|
Applies a style to the cell. When a style is applied - rather than set (see Cell.Style ) - only the differences between the new style and style properties previously assigned to the cell (through the ExcelWriter API) will take effect. For example, if the cell has a background color and the new style applied does not contain a background color, the cell's color will not be affected. However, if the new style includes a background color, it will replace the existing background color of the cell. | |
Clears a cell's content. Calling this method is equivalent to setting a cell's value to null. | |
Clears all rich text formatting within the cell. The font of the text will be set to that set in Cell.Style.Font. | |
Creates an anchor within the specified cell. An anchor represents the position of a floating (non-cell data) object within a spreadsheet. | |
Creates a new hyperlink in the cell pointing to the specified href. This hyperlink is automatically added to the worksheet. The cell value will be converted to hyperlinks. | |
Returns a CharacterRun object representing a range of characters within the cell. Use this property to set the font on specified characters within the cell. | |
Returns a CharacterRun object representing a range of characters within the cell. Use this method to set the font on specified characters within the cell. | |
Removes the comment associated with the cell. A comment is a note attached to the cell, separate from other cell content. To find out if a comment is attached to the cell, use Cell.HasComment . | |
Removes any ConditionalFormat objects from the current Cell. | |
Removes the DataValidation object associated with the cell. | |
Applies the specified ConditionalFormat to the current Cell. If the cell already has a ConditionalFormat, it will be replaced by the specified ConditionalFormat . |
|
Returns a string representation of the Cell object. | |
Unmerges the current cell. A merged cell is referenced using the location of the leftmost, topmost constituent cell. |
Nested Classes
Name |
Description |
---|---|
A CellValueType value specifies the data type of the cell's value. |