GridCell
Inheritance: java.lang.Object
public class GridCell
Represents a cell object.
Methods
Method | Description |
---|---|
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) | Checks whether this object refers to the same cell with another cell object. |
getBoolValue() | Gets the boolean value contained in the cell. |
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() | Serves as a hash function for a particular type. |
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 objectValue) | 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) | Set the formula and the value of the formula. |
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) |
containsExternalLink()
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:
Parameter | Type | Description |
---|---|---|
source | GridCell | Source GridCell object. |
copyStyle(GridTableItemStyle style)
public void copyStyle(GridTableItemStyle style)
copy the style and set the style for the cell
Parameters:
Parameter | Type | Description |
---|---|---|
style | GridTableItemStyle | The 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:
Parameter | Type | Description |
---|---|---|
note | java.lang.String | comment note. |
author | java.lang.String | comment author. |
isvisible | boolean | whether 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:
Parameter | Type | Description |
---|---|---|
validationType | int | GridValidationType. Validation type. |
isRequried | boolean | Whether the cell value is required. |
Returns: GridValidation -
equals(Object obj)
public boolean equals(Object obj)
Checks whether this object refers to the same cell with another cell object.
Parameters:
Parameter | Type | Description |
---|---|---|
obj | java.lang.Object | another GridCell object |
Returns: boolean - true if two cell objects refers to the same cell.
getBoolValue()
public boolean getBoolValue()
Gets the boolean value contained in the cell.
Returns: boolean
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()
Serves as a hash function for a particular type.
Returns: int - A hash code for current GridCell object.
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:
Parameter | Type | Description |
---|---|---|
param_boolean | boolean | Input value |
putValue(DateTime param_date)
public void putValue(DateTime param_date)
Puts a DateTime value into the cell.
Parameters:
Parameter | Type | Description |
---|---|---|
param_date | DateTime | Input value |
putValue(double param_double)
public void putValue(double param_double)
Puts a double value into the cell.
Parameters:
Parameter | Type | Description |
---|---|---|
param_double | double | Input value |
putValue(int param_int)
public void putValue(int param_int)
Puts a int value into the cell.
Parameters:
Parameter | Type | Description |
---|---|---|
param_int | int | Input value |
putValue(Object objectValue)
public void putValue(Object objectValue)
Puts an object value into the cell.same as setValue(Object param_object)
Parameters:
Parameter | Type | Description |
---|---|---|
objectValue | java.lang.Object | input value |
putValue(String param_string)
public void putValue(String param_string)
Puts a String value into the cell.
Parameters:
Parameter | Type | Description |
---|---|---|
param_string | java.lang.String | Input 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:
Parameter | Type | Description |
---|---|---|
stringValue | java.lang.String | Input value |
isConverted | boolean | True: 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:
Parameter | Type | Description |
---|---|---|
stringValue | java.lang.String | Input value |
isConverted | boolean | True: converted to other data type if appropriate. |
setStyle | boolean | True: 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:
Parameter | Type | Description |
---|---|---|
stringValue | java.lang.String | Input 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:
Parameter | Type | Description |
---|---|---|
borderStyle | WebBorderStyle | The border style. |
setCustom(String custom)
public void setCustom(String custom)
sets the custom format, null or empty string means no custom format.
Parameters:
Parameter | Type | Description |
---|---|---|
custom | java.lang.String | the 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:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setFormula(String formula, Object value)
public void setFormula(String formula, Object value)
Set the formula and the value of the formula.
Parameters:
Parameter | Type | Description |
---|---|---|
formula | java.lang.String | The formula. |
value | java.lang.Object | The value of the formula. |
setHtmlString(String value)
public void setHtmlString(String value)
Sets the html string which contains data and some formattings in this cell.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setNumberType(int numbertype)
public void setNumberType(int numbertype)
set the display format of numbers and dates
Parameters:
Parameter | Type | Description |
---|---|---|
numbertype | int | the 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:
Parameter | Type | Description |
---|---|---|
value | GridTableItemStyle |
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:
Parameter | Type | Description |
---|---|---|
value | java.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:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |