public class GridCell
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsExternalLink()
Indicates wether this cell contains an external link.
|
void |
copy(GridCell source)
Copies data from a source cell.
|
void |
copyStyle(GridTableItemStyle style)
copy the style and set the style for the cell
|
GridComment |
createComment(java.lang.String note,
java.lang.String author,
boolean isvisible)
Creates a comment object for a cell.
|
GridValidation |
createValidation(int validationType,
boolean isRequried)
Creates a validation object for a cell.
|
boolean |
equals(java.lang.Object obj)
Checks whether this object refers to the same cell with another cell object.
|
boolean |
getBoolValue()
Gets the boolean value contained in the cell.
|
int |
getColumn()
Gets column number (zero based) of the cell.
|
GridComment |
getComment()
Get comment object on this cell
|
DateTime |
getDateValue()
Gets the DateTime value contained in the cell.
|
java.lang.String |
getDisplayStringValue()
Gets the formatted string value of this cell.
|
double |
getDoubleValue()
Gets the double value contained in the cell.
|
float |
getFloatValue()
Gets the float value contained in the cell.
|
java.lang.String |
getFormula()
Gets a formula of the
GridCell. |
java.lang.String |
getHtmlString()
Gets the html string which contains data and some formattings in this cell.
|
int |
getIntValue()
Gets the integer value contained in the cell.
|
java.lang.String |
getName()
Gets the name of the cell.
|
int |
getRow()
Gets row number (zero based) of the cell.
|
java.lang.String |
getStringValue()
Gets the string value contained in the cell.
|
GridTableItemStyle |
getStyle()
Gets the copy of cell style.
|
int |
getType()
return the cell value type ,the meaning can see GridCellValueType.java
|
java.lang.Object |
getValue()
Gets the value contained in this cell.
|
int |
getWidthOfValue()
Gets the width of the value in unit of pixels.
|
int |
hashCode()
Serves as a hash function for a particular type.
|
boolean |
isErrorValue()
Checks if a formula can properly evaluate a result.
|
boolean |
isFormula()
Represents if the specified cell contains formula.
|
boolean |
isStyleSet()
Indicates if the cell's style is set.
|
void |
putValue(boolean param_boolean)
Puts a boolean value into the cell.
|
void |
putValue(DateTime param_date)
Puts a DateTime value into the cell.
|
void |
putValue(double param_double)
Puts a double value into the cell.
|
void |
putValue(int param_int)
Puts a int value into the cell.
|
void |
putValue(java.lang.Object objectValue)
Puts an object value into the cell.same as setValue(Object param_object)
|
void |
putValue(java.lang.String param_string)
Puts a String value into the cell.
|
void |
putValue(java.lang.String stringValue,
boolean isConverted)
Puts a string value into the cell and converts the value to other data type if appropriate.
|
void |
putValue(java.lang.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.
|
void |
putValueAndSetFormatByValue(java.lang.String stringValue)
Sets the cell's value with a string value and set cell format by this value.
|
void |
removeComment()
Removes the comment object of the cell.
|
void |
removeValidation()
Removes the validation object of the cell.
|
void |
setBorder(WebBorderStyle borderStyle)
Sets borders(top,bottom,left and right) for a cell,all the borders have same borderstyle.
|
void |
setCustom(java.lang.String custom)
sets the custom format, null or empty string means no custom format.
|
void |
setFormula(java.lang.String value)
Sets a formula of the
GridCell. |
void |
setFormula(java.lang.String formula,
java.lang.Object value)
Set the formula and the value of the formula.
|
void |
setHtmlString(java.lang.String value)
Sets the html string which contains data and some formattings in this cell.
|
void |
setNumberType(int numbertype)
set the display format of numbers and dates
|
void |
setStyle(GridTableItemStyle value)
Gets the copy of cell style.
|
void |
setValue(java.lang.Object value)
Gets the value contained in this cell.
|
java.lang.String |
toString()
Returns a string represents the current Cell object.
|
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
public java.lang.Object getValue()
Remarks
Possible type:null,
Boolean,
DateTime,
Double,
Integer
String.
public void setValue(java.lang.Object value)
Remarks
Possible type:null,
Boolean,
DateTime,
Double,
Integer
String.
public void copy(GridCell source)
source - Source GridCell object.public int getType()
public void putValue(DateTime param_date)
param_date - Input valuepublic void putValue(java.lang.String param_string)
param_string - Input valuepublic void putValue(java.lang.Object objectValue)
objectValue - input valuepublic void putValue(int param_int)
param_int - Input valuepublic void putValue(java.lang.String stringValue,
boolean isConverted,
boolean setStyle)
stringValue - Input valueisConverted - True: converted to other data type if appropriate.setStyle - True: set the number format to cell's style when converting to other data typepublic void putValue(java.lang.String stringValue,
boolean isConverted)
stringValue - Input valueisConverted - True: converted to other data type if appropriate.public void putValue(boolean param_boolean)
param_boolean - Input valuepublic void putValue(double param_double)
param_double - Input valuepublic boolean isFormula()
public java.lang.String getFormula()
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");
public void setFormula(java.lang.String value)
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.public void setFormula(java.lang.String formula,
java.lang.Object value)
formula - The formula.value - The value of the formula.public java.lang.String getStringValue()
public GridTableItemStyle getStyle()
public void setStyle(GridTableItemStyle value)
public void copyStyle(GridTableItemStyle style)
style - The source style.public void setCustom(java.lang.String custom)
custom - the custom string presentationpublic void putValueAndSetFormatByValue(java.lang.String stringValue)
stringValue - Input value.public void setNumberType(int numbertype)
numbertype - the value of ther numbertype,see GridTableItemStyle.NumberTypepublic DateTime getDateValue()
public int getRow()
public int getColumn()
public boolean isErrorValue()
Remarks
Only applies to formula cell.public java.lang.String getDisplayStringValue()
public int getIntValue()
public double getDoubleValue()
public float getFloatValue()
public boolean getBoolValue()
public boolean containsExternalLink()
public int getWidthOfValue()
public boolean isStyleSet()
public java.lang.String getHtmlString()
public void setHtmlString(java.lang.String value)
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - another GridCell objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void setBorder(WebBorderStyle borderStyle)
borderStyle - The border style.public GridValidation createValidation(int validationType, boolean isRequried)
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+");
validationType - GridValidationType. Validation type.isRequried - Whether the cell value is required.public void removeValidation()
public GridComment createComment(java.lang.String note, java.lang.String author, boolean isvisible)
note - comment note.author - comment author.isvisible - whether the comment is visible.public void removeComment()
public GridComment getComment()
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.