GridCell

Inheritance: java.lang.Object

public class GridCell

Represents a cell object.

Methods

MethodDescription
containsExternalLink()Indicates wether this cell contains an external link.
copy(GridCell source)Copies data from a source cell.
copyStyle(GridTableItemStyle style)copy the style and set the style for the cell
createComment(String note, String author, boolean isvisible)Creates a comment object for a cell.
createValidation(int validationType, boolean isRequried)Creates a validation object for a cell.
equals(Object obj)
getBoolValue()Gets the boolean value contained in the cell.
getCellArea()
getClass()
getColumn()Gets column number (zero based) of the cell.
getComment()Get comment object on this cell
getDateValue()Gets the DateTime value contained in the cell.
getDisplayStringValue()Gets the formatted string value of this cell.
getDoubleValue()Gets the double value contained in the cell.
getFloatValue()Gets the float value contained in the cell.
getFormula()Gets a formula of the GridCell.
getHtmlString()Gets the html string which contains data and some formattings in this cell.
getIntValue()Gets the integer value contained in the cell.
getName()Gets the name of the cell.
getRow()Gets row number (zero based) of the cell.
getStringValue()Gets the string value contained in the cell.
getStyle()Gets the copy of cell style. set the style for the cell.
getType()return the cell value type ,the meaning can see GridCellValueType.java
getValue()Gets the value contained in this cell.
getWidthOfValue()Gets the width of the value in unit of pixels.
hashCode()
isErrorValue()Checks if a formula can properly evaluate a result.
isFormula()Represents if the specified cell contains formula.
isStyleSet()Indicates if the cell’s style is set.
notify()
notifyAll()
putValue(boolean param_boolean)Puts a boolean value into the cell.
putValue(DateTime param_date)Puts a DateTime value into the cell.
putValue(double param_double)Puts a double value into the cell.
putValue(int param_int)Puts a int value into the cell.
putValue(Object param_object)Puts an object value into the cell.same as setValue(Object param_object)
putValue(String param_string)Puts a String value into the cell.
putValue(String stringValue, boolean isConverted)Puts a string value into the cell and converts the value to other data type if appropriate.
putValue(String stringValue, boolean isConverted, boolean setStyle)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 stringValue)Sets the cell’s value with a string value and set cell format by this value.
removeComment()Removes the comment object of the cell.
removeValidation()Removes the validation object of the cell.
setBorder(WebBorderStyle borderStyle)Sets borders(top,bottom,left and right) for a cell,all the borders have same borderstyle.
setCustom(String custom)sets the custom format, null or empty string means no custom format.
setFormula(String value)Sets a formula of the GridCell.
setFormula(String formula, Object value)Gets the parent worksheet.
setHtmlString(String value)Sets the html string which contains data and some formattings in this cell.
setNumberType(int numbertype)set the display format of numbers and dates
setStyle(GridTableItemStyle value)Gets the copy of cell style. set the style for the cell.
setValue(Object value)Gets the value contained in this cell.
toString()Returns a string represents the current Cell object.
wait()
wait(long arg0)
wait(long arg0, int arg1)
public boolean containsExternalLink()

Indicates wether this cell contains an external link. Only applies when the cell is a formula cell.

Returns: boolean

copy(GridCell source)

public void copy(GridCell source)

Copies data from a source cell.

Parameters:

ParameterTypeDescription
sourceGridCellSource GridCell object.

copyStyle(GridTableItemStyle style)

public void copyStyle(GridTableItemStyle style)

copy the style and set the style for the cell

Parameters:

ParameterTypeDescription
styleGridTableItemStyleThe source style.

createComment(String note, String author, boolean isvisible)

public GridComment createComment(String note, String author, boolean isvisible)

Creates a comment object for a cell.

Parameters:

ParameterTypeDescription
notejava.lang.Stringcomment note.
authorjava.lang.Stringcomment author.
isvisiblebooleanwhether the comment is visible.

Returns: GridComment - GridComment object

createValidation(int validationType, boolean isRequried)

public GridValidation createValidation(int validationType, boolean isRequried)

Creates a validation object for a cell.

Example

         GridWeb GridWeb1 = new GridWeb();
         GridWorksheet sheet = GridWeb1.getActiveSheet();
         GridValidation v = sheet.getCells().get("A1").createValidation(GridValidationType.CUSTOM_EXPRESSION, true);
         		// Sets to number validation expression.
         		v.setRegEx("\\d+");

Parameters:

ParameterTypeDescription
validationTypeintGridValidationType. Validation type.
isRequriedbooleanWhether the cell value is required.

Returns: GridValidation -

equals(Object obj)

public boolean equals(Object obj)

Parameters:

ParameterTypeDescription
objjava.lang.Object

Returns: boolean

getBoolValue()

public boolean getBoolValue()

Gets the boolean value contained in the cell.

Returns: boolean

getCellArea()

public GridCellArea getCellArea()

Returns: GridCellArea

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getColumn()

public int getColumn()

Gets column number (zero based) of the cell.

Returns: int

getComment()

public GridComment getComment()

Get comment object on this cell

Returns: GridComment

getDateValue()

public DateTime getDateValue()

Gets the DateTime value contained in the cell.

Returns: DateTime

getDisplayStringValue()

public String getDisplayStringValue()

Gets the formatted string value of this cell.

Returns: java.lang.String

getDoubleValue()

public double getDoubleValue()

Gets the double value contained in the cell.

Returns: double

getFloatValue()

public float getFloatValue()

Gets the float value contained in the cell.

Returns: float

getFormula()

public String getFormula()

Gets a formula of the GridCell.

Remarks

A formula string always begins with an equal sign (=). And please always use comma(,) as parameters delimeter, such as “=SUM(A1, E1, H2)”.

User can set any formula in Workbook designer file. Aspose.Cells will keep all the formulas. If user use this property to set a formula to a cell, major part of Workbook built-in functions is supported. And more is coming. If you have any special need for Workbook built-in functions, please let us know.

Example

         GridWeb GridWeb1 = new GridWeb();
         GridWorksheet sheet = GridWeb1.getActiveSheet();
         sheet.getCells().get("B6").setFormula("=SUM(B2:B5, E1) + sheet1!A1");

Returns: java.lang.String

getHtmlString()

public String getHtmlString()

Gets the html string which contains data and some formattings in this cell.

Returns: java.lang.String

getIntValue()

public int getIntValue()

Gets the integer value contained in the cell.

Returns: int

getName()

public String getName()

Gets the name of the cell. For example: A1, F102.

Returns: java.lang.String

getRow()

public int getRow()

Gets row number (zero based) of the cell.

Returns: int

getStringValue()

public String getStringValue()

Gets the string value contained in the cell.

Returns: java.lang.String

getStyle()

public GridTableItemStyle getStyle()

Gets the copy of cell style. set the style for the cell.

Returns: GridTableItemStyle - Style object.

getType()

public int getType()

return the cell value type ,the meaning can see GridCellValueType.java

Returns: int

getValue()

public Object getValue()

Gets the value contained in this cell.

Remarks

Possible type:

null,

Boolean,

DateTime,

Double,

Integer

String.

Returns: java.lang.Object

getWidthOfValue()

public int getWidthOfValue()

Gets the width of the value in unit of pixels.

Returns: int -

hashCode()

public int hashCode()

Returns: int

isErrorValue()

public boolean isErrorValue()

Checks if a formula can properly evaluate a result.

Remarks

Only applies to formula cell.

Returns: boolean

isFormula()

public boolean isFormula()

Represents if the specified cell contains formula.

Returns: boolean

isStyleSet()

public boolean isStyleSet()

Indicates if the cell’s style is set. If return false, it means this cell has a default cell format.

Returns: boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

putValue(boolean param_boolean)

public void putValue(boolean param_boolean)

Puts a boolean value into the cell.

Parameters:

ParameterTypeDescription
param_booleanbooleanInput value

putValue(DateTime param_date)

public void putValue(DateTime param_date)

Puts a DateTime value into the cell.

Parameters:

ParameterTypeDescription
param_dateDateTimeInput value

putValue(double param_double)

public void putValue(double param_double)

Puts a double value into the cell.

Parameters:

ParameterTypeDescription
param_doubledoubleInput value

putValue(int param_int)

public void putValue(int param_int)

Puts a int value into the cell.

Parameters:

ParameterTypeDescription
param_intintInput value

putValue(Object param_object)

public void putValue(Object param_object)

Puts an object value into the cell.same as setValue(Object param_object)

Parameters:

ParameterTypeDescription
param_objectjava.lang.Object

putValue(String param_string)

public void putValue(String param_string)

Puts a String value into the cell.

Parameters:

ParameterTypeDescription
param_stringjava.lang.StringInput value

putValue(String stringValue, boolean isConverted)

public void putValue(String stringValue, boolean isConverted)

Puts a string value into the cell and converts the value to other data type if appropriate.

Parameters:

ParameterTypeDescription
stringValuejava.lang.StringInput value
isConvertedbooleanTrue: converted to other data type if appropriate.

putValue(String stringValue, boolean isConverted, boolean setStyle)

public void putValue(String stringValue, boolean isConverted, boolean setStyle)

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.

Parameters:

ParameterTypeDescription
stringValuejava.lang.StringInput value
isConvertedbooleanTrue: converted to other data type if appropriate.
setStylebooleanTrue: set the number format to cell’s style when converting to other data type

putValueAndSetFormatByValue(String stringValue)

public void putValueAndSetFormatByValue(String stringValue)

Sets the cell’s value with a string value and set cell format by this value.

Parameters:

ParameterTypeDescription
stringValuejava.lang.StringInput value.

removeComment()

public void removeComment()

Removes the comment object of the cell.

removeValidation()

public void removeValidation()

Removes the validation object of the cell.

setBorder(WebBorderStyle borderStyle)

public void setBorder(WebBorderStyle borderStyle)

Sets borders(top,bottom,left and right) for a cell,all the borders have same borderstyle.

Parameters:

ParameterTypeDescription
borderStyleWebBorderStyleThe border style.

setCustom(String custom)

public void setCustom(String custom)

sets the custom format, null or empty string means no custom format.

Parameters:

ParameterTypeDescription
customjava.lang.Stringthe custom string presentation

setFormula(String value)

public void setFormula(String value)

Sets a formula of the GridCell.

Remarks

A formula string always begins with an equal sign (=). And please always use comma(,) as parameters delimeter, such as “=SUM(A1, E1, H2)”.

User can set any formula in Workbook designer file. Aspose.Cells will keep all the formulas. If user use this property to set a formula to a cell, major part of Workbook built-in functions is supported. And more is coming. If you have any special need for Workbook built-in functions, please let us know.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setFormula(String formula, Object value)

public void setFormula(String formula, Object value)

Gets the parent worksheet.

Parameters:

ParameterTypeDescription
formulajava.lang.String
valuejava.lang.Object

setHtmlString(String value)

public void setHtmlString(String value)

Sets the html string which contains data and some formattings in this cell.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setNumberType(int numbertype)

public void setNumberType(int numbertype)

set the display format of numbers and dates

Parameters:

ParameterTypeDescription
numbertypeintthe value of ther numbertype,see GridTableItemStyle.NumberType

setStyle(GridTableItemStyle value)

public void setStyle(GridTableItemStyle value)

Gets the copy of cell style. set the style for the cell.

Parameters:

ParameterTypeDescription
valueGridTableItemStyle

setValue(Object value)

public void setValue(Object value)

Gets the value contained in this cell.

Remarks

Possible type:

null,

Boolean,

DateTime,

Double,

Integer

String.

Parameters:

ParameterTypeDescription
valuejava.lang.Object

toString()

public String toString()

Returns a string represents the current Cell object.

Returns: java.lang.String -

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int