Class GridCell

GridCell class

Represents a cell object.

public class GridCell

Properties

NameDescription
BoolValue { get; }Gets the boolean value contained in the cell.
Column { get; }Gets column number (zero based) of the cell.
DateValue { get; }Gets the DateTime value contained in the cell.
DisplayStringValue { get; }Gets the formatted string value of this cell.
DoubleValue { get; }Gets the double value contained in the cell.
FloatValue { get; }Gets the float value contained in the cell.
Formula { get; set; }Gets or sets a formula of the Cell.
HtmlString { get; set; }Gets and sets the html string which contains data and some formattings in this cell.
IntValue { get; }Gets the integer value contained in the cell.
IsStyleSet { get; }Indicates if the cell’s style is set. If return false, it means this cell has a default cell format.
Location { get; }
Name { get; }Gets the name of the cell. For example: A1, F102.
Protected { get; set; }Indicates if the cell is protected. If the value is “true”, user can not modify the cell through the user interface. This attribute has nothing to do with the Style.CellLocked property and will not be saved to file when grid data exported. The default value is “false”.
Row { get; }Gets row number (zero based) of the cell.
StringValue { get; }Gets the string value contained in the cell.
Style { get; set; }Gets the copy of cell style. set the style for the cell.
Type { get; }return the cell value type ,the meaning can see GridCellValueType.java
Value { get; set; }Gets the value contained in this cell.
Worksheet { get; }Gets worksheet object.

Methods

NameDescription
ContainsExternalLink()Indicates wether this cell contains an external link. Only applies when the cell is a formula cell.
Copy(GridCell)Copies data from a source cell.
CopyStyle(Style)copy the style and set the style for the cell
override Equals(object)
GetCellArea()
GetFont()Gets cell font. When change the font, you should invoke “SetFont” method, to set font to cell.
GetFontColor()Gets cell font color. When change the color,you should invoke “SetFontColor” method, to set font color to cell.
override GetHashCode()
GetStyle()Gets cell style. When change the style,you should invoke “SetStyle” method, to set style to cell.
GetValidation()Gets the validation which applied to this cell.if not set return null.
GetWidthOfValue()Gets the width of the value in unit of pixels.
GetWorksheet()Gets the parent worksheet.
IsErrorValue()Checks if a formula can properly evaluate a result.
IsFormula()Represents if the specified cell contains formula.
PutValue(bool)Puts a boolean value into the cell.
PutValue(DateTime)Puts a DateTime value into the cell.
PutValue(double)Puts a double value into the cell.
PutValue(int)Puts a int value into the cell.
PutValue(object)Puts an object value into the cell.same as setValue(Object param_object)
PutValue(string)Puts a String value into the cell.
PutValue(string, bool)Puts a string value into the cell and converts the value to other data type if appropriate.
PutValue(string, bool, bool)Puts a value into the cell, if appropriate the value will be converted to other data type and cell’s number format will be reset.
PutValueAndSetFormatByValue(string)Sets the cell’s value with a string value and set cell format by this value.
SetCellValue(object)If the value is a formula,this method set cell’s value as FormulaType,
SetCustom(string)sets the custom format, null or empty string means no custom format.
SetFont(Font)Sets font to cell. To improve performance,implement “SetFont” method, not implement “Font” property.
SetFontColor(Color)Sets font color to cell. To improve performance,implement “SetFontColor” method, not implement “FontColor” property.
SetFormula(string, object)Set the formula and the value of the formula.
SetNumberType(int)set the display format of numbers and dates
SetStyle(Style)Sets style to cell. To improve performance,implement “SetStyle” method, not implement “Style” property.
ToString()Returns a string represents the current Cell object.
operator ==
operator !=

See Also