public class Cell
extends java.lang.Object
Example
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
//Put a string into a cell
Cell cell = cells.get(0, 0);
cell.putValue("Hello");
String first = cell.getStringValue();
//Put an integer into a cell
cell = cells.get("B1");
cell.putValue(12);
int second = cell.getIntValue();
//Put a double into a cell
cell = cells.get(0, 2);
cell.putValue(-1.234);
double third = cell.getDoubleValue();
//Put a formula into a cell
cell = cells.get("D1");
cell.setFormula("=B1 + C1");
//Put a combined formula: "sum(average(b1,c1), b1)" to cell at b2
cell = cells.get("b2");
cell.setFormula("=sum(average(b1,c1), b1)");
//Set style of a cell
Style style = cell.getStyle();
//Set background color
style.setBackgroundColor(Color.getYellow());
//Set format of a cell
style.getFont().setName("Courier New");
style.setVerticalAlignment(TextAlignmentType.TOP);
cell.setStyle(style);
| Modifier and Type | Method and Description |
|---|---|
void |
calculate(boolean ignoreError,
ICustomFunction customFunction)
Deprecated.
Use Calculate(CalculationOptions) method instead.
|
void |
calculate(CalculationOptions options)
Calculates the formula of the cell.
|
FontSetting |
characters(int startIndex,
int length)
Returns a Characters object that represents a range of characters within the cell text.
|
boolean |
containsExternalLink()
Indicates whether this cell contains an external link.
|
void |
copy(Cell cell)
Copies data from a source cell.
|
boolean |
equals(Cell cell)
Checks whether this object refers to the same cell with another cell object.
|
boolean |
equals(java.lang.Object obj)
Checks whether this object refers to the same cell with another.
|
CellArea |
getArrayRange()
Gets the array range if the cell's formula is an array formula.
|
boolean |
getBoolValue()
Gets the boolean value contained in the cell.
|
FontSetting[] |
getCharacters()
Returns all Characters objects
that represents a range of characters within the cell text.
|
FontSetting[] |
getCharacters(boolean flag)
Returns all Characters objects
that represents a range of characters within the cell text.
|
int |
getColumn()
Gets column number (zero based) of the cell.
|
Comment |
getComment()
Gets the comment of this cell.
|
ConditionalFormattingResult |
getConditionalFormattingResult()
Get the result of the conditional formatting.
|
DateTime |
getDateTimeValue()
Gets the DateTime value contained in the cell.
|
Cell[] |
getDependents(boolean isAll)
Get all cells whose formula references to this cell directly.
|
java.util.Iterator |
getDependentsInCalculation(boolean recursive)
Gets all cells whose calculated result depends on this cell.
|
java.lang.String |
getDisplayStringValue()
Gets the formatted string value of this cell by cell's display style.
|
Style |
getDisplayStyle()
Gets the display style of the cell.
|
Style |
getDisplayStyle(boolean includeMergedBorders)
Gets the display style of the cell.
|
double |
getDoubleValue()
Gets the double value contained in the cell.
|
float |
getFloatValue()
Gets the float value contained in the cell.
|
FormatConditionCollection[] |
getFormatConditions()
Gets format conditions which applies to this cell.
|
java.lang.String |
getFormula()
Gets a formula of the
Cell. |
java.lang.String |
getFormula(boolean isR1C1,
boolean isLocal)
Get the formula of this cell.
|
java.lang.String |
getFormulaLocal()
Get the locale formatted formula of the cell.
|
int |
getHeightOfValue()
Gets the height of the value in unit of pixels.
|
java.lang.String |
getHtmlString()
Gets the html string which contains data and some formats in this cell.
|
java.lang.String |
getHtmlString(boolean html5)
Gets the html string which contains data and some formats in this cell.
|
int |
getIntValue()
Gets the integer value contained in the cell.
|
java.util.Iterator |
getLeafs()
Deprecated.
Use GetDependentsInCalculation(bool) instead.
|
java.util.Iterator |
getLeafs(boolean recursive)
Deprecated.
Use GetDependentsInCalculation(bool) instead.
|
Range |
getMergedRange()
Returns a
Range object which represents a merged range. |
java.lang.String |
getName()
Gets the name of the cell.
|
int |
getNumberCategoryType()
Represents the category type of this cell's number formatting.
|
ReferredAreaCollection |
getPrecedents()
Gets all references appearing in this cell's formula.
|
java.util.Iterator |
getPrecedentsInCalculation()
Gets all precedents(reference to cells in current workbook) used by this cell's formula while calculating it.
|
java.lang.String |
getR1C1Formula()
Gets a R1C1 formula of the
Cell. |
int |
getRow()
Gets row number (zero based) of the cell.
|
int |
getSharedStyleIndex()
Gets cell's shared style index in the style pool.
|
java.lang.String |
getStringValue()
Gets the string value contained in the cell.
|
java.lang.String |
getStringValue(int formatStrategy)
Gets the string value by specific formatted strategy.
|
java.lang.String |
getStringValueWithoutFormat()
Deprecated.
Use GetStringValue(CellValueFormatStrategy) with CellValueFormatStrategy.None instead.
|
Style |
getStyle()
Gets the cell style.
|
Style |
getStyle(boolean checkBorders)
If checkBorders is true, check whether other cells' borders will effect the style of this cell.
|
ListObject |
getTable()
Gets the table which contains this cell.
|
int |
getType()
Represents cell value type.
|
Validation |
getValidation()
Gets the validation applied to this cell.
|
boolean |
getValidationValue()
Gets the value of validation which applied to this cell.
|
java.lang.Object |
getValue()
Gets the value contained in this cell.
|
int |
getWidthOfValue()
Gets the width of the value in unit of pixels.
|
Worksheet |
getWorksheet()
Gets the parent worksheet.
|
boolean |
hasCustomStyle()
Indicates whether this cell has custom style settings(different from the default one inherited
from corresponding row, column, or workbook).
|
int |
hashCode()
Serves as a hash function for a particular type.
|
void |
insertText(int index,
java.lang.String text)
Insert some characters to the cell.
|
boolean |
isArrayFormula()
Indicates whether the cell formula is an array formula.
|
boolean |
isArrayHeader()
Indicates the cell's formula is and array formula
and it is the first cell of the array.
|
boolean |
isDynamicArrayFormula()
Indicates whether the cell's formula is dynamic array formula(true) or legacy array formula(false).
|
boolean |
isErrorValue()
Checks if the value of this cell is an error.
|
boolean |
isFormula()
Represents if the specified cell contains formula.
|
boolean |
isInArray()
Deprecated.
Use IsArrayFormula instead.
|
boolean |
isInTable()
Deprecated.
Use IsTableFormula instead.
|
boolean |
isMerged()
Checks if a cell is part of a merged range or not.
|
boolean |
isNumericValue()
Indicates whether the inner value of this cell is numeric(int, double and datetime)
|
boolean |
isRichText()
Indicates whether the cell string value is a rich text.
|
boolean |
isSharedFormula()
Indicates whether the cell formula is part of shared formula.
|
boolean |
isStyleSet()
Indicates if the cell's style is set.
|
boolean |
isTableFormula()
Indicates whether this cell is part of table formula.
|
void |
putValue(boolean boolValue)
Puts a boolean value into the cell.
|
void |
putValue(DateTime dateTime)
Puts a DateTime value into the cell.
|
void |
putValue(double doubleValue)
Puts a double value into the cell.
|
void |
putValue(int intValue)
Puts an integer value into the cell.
|
void |
putValue(java.lang.Object objectValue)
Puts an object value into the cell.
|
void |
putValue(java.lang.String stringValue)
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 |
removeArrayFormula(boolean leaveNormalFormula)
Remove array formula.
|
void |
replace(java.lang.String placeHolder,
java.lang.String newValue,
ReplaceOptions options)
Replace text of the cell with options.
|
void |
setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber)
Sets an array formula(legacy array formula entered via CTRL+SHIFT+ENTER in ms excel) to a range of cells.
|
void |
setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber,
boolean isR1C1,
boolean isLocal)
Deprecated.
Use FormulaParseOptions for more options instead.
|
void |
setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options)
Sets an array formula to a range of cells.
|
void |
setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options,
java.lang.Object[][] values)
Sets an array formula to a range of cells.
|
void |
setCharacters(FontSetting[] characters)
Sets rich text format of the cell.
|
CellArea |
setDynamicArrayFormula(java.lang.String arrayFormula,
FormulaParseOptions options,
boolean calculateValue)
Sets dynamic array formula and make the formula spill into neighboring cells if possible.
|
CellArea |
setDynamicArrayFormula(java.lang.String arrayFormula,
FormulaParseOptions options,
java.lang.Object[][] values,
boolean calculateRange,
boolean calculateValue)
Sets dynamic array formula and make the formula spill into neighboring cells if possible.
|
CellArea |
setDynamicArrayFormula(java.lang.String arrayFormula,
FormulaParseOptions options,
java.lang.Object[][] values,
boolean calculateRange,
boolean calculateValue,
CalculationOptions copts)
Sets dynamic array formula and make the formula spill into neighboring cells if possible.
|
void |
setFormula(java.lang.String value)
Sets a formula of the
Cell. |
void |
setFormula(java.lang.String formula,
boolean isR1C1,
boolean isLocal,
java.lang.Object value)
Deprecated.
Use FormulaParseOptions for more options instead.
|
void |
setFormula(java.lang.String formula,
FormulaParseOptions options,
java.lang.Object value)
Set the formula and the value(calculated result) of the formula.
|
void |
setFormula(java.lang.String formula,
java.lang.Object value)
Set the formula and the value(calculated result) of the formula.
|
void |
setFormulaLocal(java.lang.String value)
Get the locale formatted formula of the cell.
|
void |
setHtmlString(java.lang.String value)
Sets the html string which contains data and some formats in this cell.
|
void |
setR1C1Formula(java.lang.String value)
Sets a R1C1 formula of the
Cell. |
void |
setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber)
Sets shared formulas to a range of cells.
|
void |
setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber,
boolean isR1C1,
boolean isLocal)
Deprecated.
Use FormulaParseOptions for more options instead.
|
void |
setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options)
Sets shared formulas to a range of cells.
|
void |
setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options,
java.lang.Object[][] values)
Sets shared formulas to a range of cells.
|
void |
setStyle(Style style)
Sets the cell style.
|
void |
setStyle(Style style,
boolean explicitFlag)
Apply the cell style.
|
void |
setStyle(Style style,
StyleFlag flag)
Apply the cell style.
|
void |
setTableFormula(int rowNumber,
int columnNumber,
int rowIndexOfInputCell,
int columnIndexOfInputCell,
boolean isRowInput,
java.lang.Object[][] values)
Create one-variable data table for given range starting from this cell.
|
void |
setTableFormula(int rowNumber,
int columnNumber,
int rowIndexOfRowInputCell,
int columnIndexOfRowInputCell,
int rowIndexOfColumnInputCell,
int columnIndexOfColumnInputCell,
java.lang.Object[][] values)
Create two-variable data table for given range starting from this cell.
|
void |
setTableFormula(int rowNumber,
int columnNumber,
java.lang.String inputCell,
boolean isRowInput,
java.lang.Object[][] values)
Create one-variable data table for given range starting from this cell.
|
void |
setTableFormula(int rowNumber,
int columnNumber,
java.lang.String rowInputCell,
java.lang.String columnInputCell,
java.lang.Object[][] values)
Create two-variable data table for given range starting from this cell.
|
void |
setValue(java.lang.Object value)
Gets the value contained in this cell.
|
java.lang.String |
toJson()
Convert
Cell to JSON struct data. |
java.lang.String |
toString()
Returns a string represents the current Cell object.
|
public void calculate(CalculationOptions options)
options - Options for calculationpublic void calculate(boolean ignoreError,
ICustomFunction customFunction)
Remarks
NOTE: This member is now obsolete. Instead, please use Calculate(CalculationOptions) method. This method will be removed 12 months later since August 2020. Aspose apologizes for any inconvenience you may have experienced.ignoreError - Indicates if hide the error in calculating formulas.
The error may be unsupported function, external links, etc.customFunction - The custom formula calculation functions to extend the calculation engine.public Worksheet getWorksheet()
public void putValue(boolean boolValue)
boolValue - public void putValue(int intValue)
intValue - Input valuepublic void putValue(double doubleValue)
doubleValue - 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(java.lang.String stringValue)
stringValue - Input valuepublic void putValue(DateTime dateTime)
Remarks
Setting a DateTime value for a cell dose not means the cell will be formatted as date time automatically. DateTime value was maintained as numeric value in the data model of both ms excel and Aspose.Cells. Whether the numeric value will be taken as the numeric value itself or date time depends on the number format applied on this cell. If this cell has not been formatted as date time, it will be displayed as a numeric value even though what you input is DateTime.Example
This example shows how to set DateTime value to a cell and make it be displayed as date time.
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
//Put date time into a cell
Cell cell = cells.get(0, 0);
cell.putValue(new DateTime(2023, 5, 15));
Style style = cell.getStyle(false);
style.setNumber(14);
cell.setStyle(style);
dateTime - Input valuepublic DateTime getDateTimeValue()
public void putValue(java.lang.Object objectValue)
objectValue - input valuepublic int getRow()
public int getColumn()
public boolean isFormula()
public int getType()
See CellValueType.
public java.lang.String getName()
Remarks
A cell name includes its column letter and row number. For example, the name of a cell in row 0 and column 0 is A1.public boolean isErrorValue()
Remarks
Also applies to formula cell to check whether the calculated result is an error.public boolean isNumericValue()
Remarks
Also applies to formula cell to check the calculated resultpublic java.lang.String getStringValue(int formatStrategy)
formatStrategy - CellValueFormatStrategy. The formatted strategy.public java.lang.String getStringValue()
public java.lang.String getStringValueWithoutFormat()
Remarks
NOTE: This method is now obsolete. Instead, User should get the value object and format it according to the value type and the specific requirement. This property will be removed 12 months later since December 2020. Aspose apologizes for any inconvenience you may have experienced.public int getNumberCategoryType()
See NumberCategoryType.
public java.lang.String getDisplayStringValue()
public int getIntValue()
public double getDoubleValue()
public float getFloatValue()
public boolean getBoolValue()
public int getWidthOfValue()
public int getHeightOfValue()
public Style getDisplayStyle()
public Style getDisplayStyle(boolean includeMergedBorders)
includeMergedBorders - Indicates whether checking borders of the merged cells.public FormatConditionCollection[] getFormatConditions()
FormatConditionCollection objectpublic Style getStyle()
Remarks
To change the style of the cell, please call Cell.SetStyle() method after modifying the returned style object. This method is same withgetStyle(boolean) with true value for the parameter.public Style getStyle(boolean checkBorders)
Remarks
checkBorders - Check other cells' borderspublic void setStyle(Style style)
Remarks
If the border settings are changed, the border of adjust cells will be updated too.style - The cell style.public void setStyle(Style style, boolean explicitFlag)
style - The cell style.explicitFlag - True, only overwriting formatting which is explicitly set.public void setStyle(Style style, StyleFlag flag)
style - The cell style.flag - The style flag.public boolean hasCustomStyle()
public int getSharedStyleIndex()
public java.lang.String getFormula()
Cell.
Remarks
A formula string always begins with an equal sign (=). And please always use comma(,) as parameters delimiter, such as "=SUM(A1, E1, H2)".Example
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
cells.get("B6").setFormula("=SUM(B2:B5, E1) + sheet1!A1");
public void setFormula(java.lang.String value)
Cell.
Remarks
A formula string always begins with an equal sign (=). And please always use comma(,) as parameters delimiter, such as "=SUM(A1, E1, H2)".public java.lang.String getFormulaLocal()
public void setFormulaLocal(java.lang.String value)
public java.lang.String getR1C1Formula()
Cell.public void setR1C1Formula(java.lang.String value)
Cell.public void setFormula(java.lang.String formula,
java.lang.Object value)
formula - The formula.value - The value(calculated result) of the formula.public java.lang.String getFormula(boolean isR1C1,
boolean isLocal)
isR1C1 - Whether the formula needs to be formatted as R1C1.isLocal - Whether the formula needs to be formatted by locale.public void setFormula(java.lang.String formula,
boolean isR1C1,
boolean isLocal,
java.lang.Object value)
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.SetFormula(string,FormulaParseOptions,object). This property will be removed 12 months later since December 2019. Aspose apologizes for any inconvenience you may have experienced.formula - The formula.isR1C1 - Whether the formula is R1C1 formula.isLocal - Whether the formula is locale formatted.value - The value of the formula.public void setFormula(java.lang.String formula,
FormulaParseOptions options,
java.lang.Object value)
formula - The formula.options - Options for parsing the formula.value - The value(calculated result) of the formula.public void setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber,
boolean isR1C1,
boolean isLocal)
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.SetArrayFormula(string,int,int,FormulaParseOptions). This property will be removed 12 months later since December 2019. Aspose apologizes for any inconvenience you may have experienced.arrayFormula - Array formula.rowNumber - Number of rows to populate result of the array formula.columnNumber - Number of columns to populate result of the array formula.isR1C1 - whether the formula is R1C1 formulaisLocal - whether the formula is locale formattedpublic void setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber)
arrayFormula - Array formula.rowNumber - Number of rows to populate result of the array formula.columnNumber - Number of columns to populate result of the array formula.public void setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options)
arrayFormula - Array formula.rowNumber - Number of rows to populate result of the array formula.columnNumber - Number of columns to populate result of the array formula.options - Options for parsing the formula.public void setArrayFormula(java.lang.String arrayFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options,
java.lang.Object[][] values)
arrayFormula - Array formula.rowNumber - Number of rows to populate result of the array formula.columnNumber - Number of columns to populate result of the array formula.options - Options for parsing the formula.values - values for those cells with given array formulapublic void setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber,
boolean isR1C1,
boolean isLocal)
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.SetSharedFormula(string,int,int,FormulaParseOptions). This property will be removed 12 months later since December 2019. Aspose apologizes for any inconvenience you may have experienced.sharedFormula - Shared formula.rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.isR1C1 - whether the formula is R1C1 formulaisLocal - whether the formula is locale formattedpublic void setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber)
Remarks
sharedFormula - Shared formula.rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.public void setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options)
sharedFormula - Shared formula.rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.options - Options for parsing the formula.public void setSharedFormula(java.lang.String sharedFormula,
int rowNumber,
int columnNumber,
FormulaParseOptions options,
java.lang.Object[][] values)
sharedFormula - Shared formula.rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.options - Options for parsing the formula.values - values for those cells with given shared formulapublic boolean containsExternalLink()
public ReferredAreaCollection getPrecedents()
Remarks
Example
Workbook workbook = new Workbook();
Cells cells = workbook.getWorksheets().get(0).getCells();
cells.get("A1").setFormula("=B1+SUM(B1:B10)+[Book1.xls]Sheet1!A1");
ReferredAreaCollection areas = cells.get("A1").getPrecedents();
for (int i = 0; i <areas.getCount(); i++)
{
ReferredArea area = areas.get(i);
StringBuilder stringBuilder = new StringBuilder();
if (area.isExternalLink())
{
stringBuilder.append("[");
stringBuilder.append(area.getExternalFileName());
stringBuilder.append("]");
}
stringBuilder.append(area.getSheetName());
stringBuilder.append("!");
stringBuilder.append(CellsHelper.cellIndexToName(area.getStartRow(), area.getStartColumn()));
if (area.isArea())
{
stringBuilder.append(":");
stringBuilder.append(CellsHelper.cellIndexToName(area.getEndRow(), area.getEndColumn()));
}
System.out.println(stringBuilder.toString());
}
public Cell[] getDependents(boolean isAll)
Remarks
Example
Workbook workbook = new Workbook();
Cells cells = workbook.getWorksheets().get(0).getCells();
cells.get("A1").setFormula("=B1+SUM(B1:B10)+[Book1.xls]Sheet1!B2");
cells.get("A2").setFormula("=IF(TRUE,B2,B1)");
Cell[] dependents = cells.get("B1").getDependents(true);
for (int i = 0; i <dependents.length; i++)
{
System.out.println(dependents[i].getName());
}
isAll - Indicates whether check formulas in other worksheetspublic java.util.Iterator getPrecedentsInCalculation()
Remarks
This method can only work with the situation thatFormulaSettings.getEnableCalculationChain()
is true for the workbook and the workbook has been fully calculated.
If this cell is not a formula or it does not reference to any other cells, null will be returned.
Example
Workbook workbook = new Workbook();
Cells cells = workbook.getWorksheets().get(0).getCells();
cells.get("A2").setFormula("=IF(TRUE,B2,B1)");
workbook.getSettings().getFormulaSettings().setEnableCalculationChain(true);
workbook.calculateFormula();
Iterator en = cells.get("A2").getPrecedentsInCalculation();
System.out.println("A2's calculation precedents:");
while(en.hasNext())
{
ReferredArea r = (ReferredArea)en.next();
System.out.println(r);
}
public java.util.Iterator getDependentsInCalculation(boolean recursive)
Remarks
To use this method, please make sure the workbook has been set with true value forFormulaSettings.getEnableCalculationChain() and has been fully calculated with this setting.
If there is no formula reference to this cell, null will be returned.
Example
Workbook workbook = new Workbook();
Cells cells = workbook.getWorksheets().get(0).getCells();
cells.get("A1").setFormula("=B1+SUM(B1:B10)+[Book1.xls]Sheet1!B2");
cells.get("A2").setFormula("=IF(TRUE,B2,B1)");
workbook.getSettings().getFormulaSettings().setEnableCalculationChain(true);
workbook.calculateFormula();
Iterator en = cells.get("B1").getDependentsInCalculation(false);
System.out.println("B1's calculation dependents:");
while(en.hasNext())
{
Cell c = (Cell)en.next();
System.out.println(c.getName());
}
en = cells.get("B2").getDependentsInCalculation(false);
System.out.println("B2's calculation dependents:");
while(en.hasNext())
{
Cell c = (Cell)en.next();
System.out.println(c.getName());
}
recursive - Whether returns those dependents which do not reference to this cell directly
but reference to other leafs of this cellpublic java.util.Iterator getLeafs()
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.GetDependentsInCalculation(bool) to get all dependents in calculation chain. This property will be removed 12 months later since May 2022. Aspose apologizes for any inconvenience you may have experienced.public java.util.Iterator getLeafs(boolean recursive)
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.GetDependentsInCalculation(bool) to get all dependents in calculation chain. This property will be removed 12 months later since May 2022. Aspose apologizes for any inconvenience you may have experienced.recursive - Whether returns those leafs that do not reference to this cell directly
but reference to other leafs of this cellpublic boolean isArrayHeader()
public boolean isDynamicArrayFormula()
public CellArea getArrayRange()
Remarks
Only applies when the cell's formula is an array formulapublic boolean isArrayFormula()
public boolean isInArray()
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.IsArrayFormula to check whether the cell formula is an array formula. This property will be removed 12 months later since May 2018. Aspose apologizes for any inconvenience you may have experienced.public boolean isSharedFormula()
public boolean isTableFormula()
public boolean isInTable()
Remarks
NOTE: This class is now obsolete. Instead, please use Cell.IsTableFormula to check whether the cell formula is part of table formula. This property will be removed 12 months later since May 2018. Aspose apologizes for any inconvenience you may have experienced.public CellArea setDynamicArrayFormula(java.lang.String arrayFormula, FormulaParseOptions options, boolean calculateValue)
arrayFormula - the formula expressionoptions - options to parse formula.
"Parse" option will be ignored and the formula will always be parsed immediatelycalculateValue - whether calculate this dynamic array formula for those cells in the spilled range.public CellArea setDynamicArrayFormula(java.lang.String arrayFormula, FormulaParseOptions options, java.lang.Object[][] values, boolean calculateRange, boolean calculateValue)
arrayFormula - the formula expressionoptions - options to parse formula.
"Parse" option will be ignored and the formula will always be parsed immediatelyvalues - values(calculated results) for those cells with given dynamic array formulacalculateRange - Whether calculate the spilled range for this dynamic array formula.
If the "values" parameter is not null and this flag is false,
then the spilled range's height will be values.Length and width will be values[0].Length.calculateValue - whether calculate this dynamic array formula for those cells in the spilled range when "values" is null
or corresponding item in "values" for one cell is null.public CellArea setDynamicArrayFormula(java.lang.String arrayFormula, FormulaParseOptions options, java.lang.Object[][] values, boolean calculateRange, boolean calculateValue, CalculationOptions copts)
arrayFormula - the formula expressionoptions - options to parse formula.
"Parse" option will be ignored and the formula will always be parsed immediatelyvalues - values(calculated results) for those cells with given dynamic array formulacalculateRange - Whether calculate the spilled range for this dynamic array formula.
If the "values" parameter is not null and this flag is false,
then the spilled range's height will be values.Length and width will be values[0].Length.calculateValue - whether calculate this dynamic array formula for those cells in the spilled range when "values" is null
or corresponding item in "values" for one cell is null.copts - The options for calculating formula.
Commonly, for performance consideration, the CalculationOptions.getRecursive() property should be false.public void setTableFormula(int rowNumber,
int columnNumber,
java.lang.String rowInputCell,
java.lang.String columnInputCell,
java.lang.Object[][] values)
rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.rowInputCell - the row input cellcolumnInputCell - the column input cellvalues - values for cells in table formula rangepublic void setTableFormula(int rowNumber,
int columnNumber,
java.lang.String inputCell,
boolean isRowInput,
java.lang.Object[][] values)
rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.inputCell - the input cellisRowInput - Indicates whether the input cell is a row input cell(true) or a column input cell(false).values - values for cells in table formula rangepublic void setTableFormula(int rowNumber,
int columnNumber,
int rowIndexOfRowInputCell,
int columnIndexOfRowInputCell,
int rowIndexOfColumnInputCell,
int columnIndexOfColumnInputCell,
java.lang.Object[][] values)
rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.rowIndexOfRowInputCell - row index of the row input cellcolumnIndexOfRowInputCell - column index of the row input cellrowIndexOfColumnInputCell - row index of the column input cellcolumnIndexOfColumnInputCell - column index of the column input cellvalues - values for cells in table formula rangepublic void setTableFormula(int rowNumber,
int columnNumber,
int rowIndexOfInputCell,
int columnIndexOfInputCell,
boolean isRowInput,
java.lang.Object[][] values)
rowNumber - Number of rows to populate the formula.columnNumber - Number of columns to populate the formula.rowIndexOfInputCell - row index of the input cellcolumnIndexOfInputCell - column index of the input cellisRowInput - Indicates whether the input cell is a row input cell(true) or a column input cell(false).values - values for cells in table formula rangepublic void removeArrayFormula(boolean leaveNormalFormula)
leaveNormalFormula - True represents converting the array formula to normal formula.public void copy(Cell cell)
cell - Source Cell object.public java.lang.Object getValue()
Remarks
Possible type:null,
Boolean,
DateTime,
Double,
Integer
String.
For int value, it may be returned as an Integer object or a Double object. And there is no guarantee that the returned value will be kept as the same type of object always.public void setValue(java.lang.Object value)
Remarks
Possible type:null,
Boolean,
DateTime,
Double,
Integer
String.
For int value, it may be returned as an Integer object or a Double object. And there is no guarantee that the returned value will be kept as the same type of object always.public boolean isStyleSet()
public FontSetting characters(int startIndex, int length)
Remarks
This method only works on cell with string value.Example
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
cells.get("A1").putValue("Helloworld");
cells.get("A1").characters(5, 5).getFont().setBold(true);
cells.get("A1").characters(5, 5).getFont().setColor(Color.getBlue());
startIndex - The index of the start of the character.length - The number of characters.public void replace(java.lang.String placeHolder,
java.lang.String newValue,
ReplaceOptions options)
placeHolder - Cell placeholdernewValue - String value to replaceoptions - The replace optionspublic void insertText(int index,
java.lang.String text)
index - The index.text - Inserted text.public boolean isRichText()
public FontSetting[] getCharacters()
public FontSetting[] getCharacters(boolean flag)
flag - Indicates whether applying table style to the cell if the cell is in the table.public void setCharacters(FontSetting[] characters)
characters - All Characters objects.public boolean isMerged()
public Range getMergedRange()
Range object which represents a merged range.Range object. Null if this cell is not merged.public Comment getComment()
Remarks
If there is no comment applies to the cell, returns null.public java.lang.String getHtmlString()
public void setHtmlString(java.lang.String value)
public java.lang.String getHtmlString(boolean html5)
html5 - Indicates whether the value is compatible for html5public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toJson()
Cell to JSON struct data.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - another objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(Cell cell)
cell - another cell objectpublic ConditionalFormattingResult getConditionalFormattingResult()
Remarks
Returns null if no conditional formatting is applied to this cell,public Validation getValidation()
public boolean getValidationValue()
public ListObject getTable()
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 2001-2023. All Rights Reserved.