Cell

Cell class

Encapsulates the object that represents a single Workbook cell.

Properties

NameTypeDescription
WorksheetWorksheetGets the parent worksheet.
DateTimeValueDateTimeGets the DateTime value contained in the cell.
RowNumberGets row number (zero based) of the cell.
ColumnNumberGets column number (zero based) of the cell.
IsFormulabooleanRepresents if the specified cell contains formula.
HasCustomFunctionboolean
TypeNumberRepresents cell value type. The value of the property is CellValueType integer constant.
NameStringGets the name of the cell. A cell name includes its column letter and row number. For example, the name of a cell in row
IsErrorValuebooleanChecks if the value of this cell is an error. Also applies to formula cell to check whether the calculated result is an
IsNumericValuebooleanIndicates whether the value of this cell is numeric(int, double and datetime) Also applies to formula cell to check the
StringValueStringGets the string value contained in the cell. If the type of this cell is string, then return the string value itself. Fo
StringValueWithoutFormatStringGets cell’s value as string without any format. NOTE: This method is now obsolete. Instead, User should get the value ob
NumberCategoryTypeNumberRepresents the category type of this cell’s number formatting. The value of the property is NumberCategoryType integer c
DisplayStringValueStringGets the formatted string value of this cell by cell’s display style.
IntValueNumberGets the integer value contained in the cell.
DoubleValueNumberGets the double value contained in the cell.
FloatValueNumberGets the float value contained in the cell.
BoolValuebooleanGets the boolean value contained in the cell.
HasCustomStylebooleanIndicates whether this cell has custom style settings(different from the default one inherited from corresponding row, c
SharedStyleIndexNumberGets cell’s shared style index in the style pool.
FormulaStringGets or sets a formula of the Cell . A formula string always begins with an equal sign (=). And please always use comma(
FormulaLocalStringGet the locale formatted formula of the cell.
R1C1FormulaStringGets or sets a R1C1 formula of the Cell .
ContainsExternalLinkbooleanIndicates whether this cell contains an external link. Only applies when the cell is a formula cell.
IsArrayHeaderbooleanIndicates the cell’s formula is an array formula and it is the first cell of the array.
IsDynamicArrayFormulabooleanIndicates whether the cell’s formula is dynamic array formula(true) or legacy array formula(false).
IsArrayFormulabooleanIndicates whether the cell formula is an array formula.
IsInArraybooleanIndicates whether the cell formula is an array formula. NOTE: This class is now obsolete. Instead, please use Cell.IsArr
IsSharedFormulabooleanIndicates whether the cell formula is part of shared formula.
IsTableFormulabooleanIndicates whether this cell is part of table formula.
IsInTablebooleanIndicates whether this cell is part of table formula. NOTE: This class is now obsolete. Instead, please use Cell.IsTable
ValueObjectGets/sets the value contained in this cell. Possible type: null, Boolean, DateTime, Double, Integer String. For int valu
IsStyleSetbooleanIndicates if the cell’s style is set. If return false, it means this cell has a default cell format.
IsMergedbooleanChecks if a cell is part of a merged range or not.
CommentCommentGets the comment of this cell. If there is no comment applies to the cell, returns null.
HtmlStringStringGets and sets the html string which contains data and some formats in this cell.
IsCheckBoxStyleboolean
EmbeddedImagebyte[]Gets and sets the embeddedn image in the cell.

Methods

NameDescription
getArrayRangeGets the array range if the cell’s formula is an array formula.

Only applies when the cell’s formula is an array formul | | setDynamicArrayFormula | Sets dynamic array formula and make the formula spill into neighboring cells if possible.

the returned range may be not | | setTableFormula | Create two-variable data table for given range starting from this cell. | | removeArrayFormula | Remove array formula. | | copy | Copies data from a source cell. | | characters | Returns a Characters object that represents a range of characters within the cell text.

This method only works on cell | | replace | Replace text of the cell with options. | | insertText | Insert some characters to the cell. If the cell is rich formatted, this method could keep the original formatting. | | isRichText | Indicates whether the string value of this cell is a rich formatted text. | | getCharacters | Returns all Characters objects that represents a range of characters within the cell text. | | setCharacters | Sets rich text format of the cell. | | getMergedRange | Returns a Range object which represents a merged range. | | getHtmlString | Gets the html string which contains data and some formats in this cell. | | toString | Returns a string represents the current Cell object. | | toJson | Convert Cell to JSON struct data. | | equals | Checks whether this object refers to the same cell with another. | | hashCode | Serves as a hash function for a particular type. | | getConditionalFormattingResult | Get the result of the conditional formatting.

Returns null if no conditional formatting is applied to this cell, | | getValidation | Gets the validation applied to this cell. | | getValidationValue | Gets the value of validation which applied to this cell. | | getTable | Gets the table which contains this cell. | | getRichValue | | | calculate | Calculates the formula of the cell. | | putValue | Puts a boolean value into the cell. | | getStringValue | Gets the string value by specific formatted strategy. | | getWidthOfValue | Gets the width of the value in unit of pixels. | | getHeightOfValue | Gets the height of the value in unit of pixels. | | getDisplayStyle | Gets the display style of the cell. If this cell is also affected by other settings such as conditional formatting, list | | getFormatConditions | Gets format conditions which applies to this cell. | | getStyle | Gets the cell style.

To change the style of the cell, please call Cell.SetStyle() method after modifying the returned s | | setStyle | Sets the cell style.

If the border settings are changed, the border of adjust cells will be updated too. | | setFormula | Set the formula and the value(calculated result) of the formula. | | getFormula | Get the formula of this cell. | | setArrayFormula | Sets an array formula to a range of cells.

NOTE: This class is now obsolete. Instead, please use Cell.SetArrayFormula(s | | setSharedFormula | Sets a formula to a range of cells.

NOTE: This class is now obsolete. Instead, please use Cell.SetSharedFormula(string, | | getPrecedents | Gets all references appearing in this cell’s formula.

Returns null if this is not a formula cell. All references appear | | getDependents | Get all cells whose formula references to this cell directly.

If one reference containing this cell appears in one cell | | getPrecedentsInCalculation | Gets all precedents(reference to cells in current workbook) used by this cell’s formula while calculating it.

This meth | | getDependentsInCalculation | Gets all cells whose calculated result depends on this cell.

To use this method, please make sure the workbook has been | | getLeafs | Get all cells which reference to this cell directly and need to be updated when this cell is modified.

NOTE: This class |

Cell.Worksheet property

Gets the parent worksheet.

Type: Worksheet

Cell.DateTimeValue property

Gets the DateTime value contained in the cell.

Type: DateTime

Cell.Row property

Gets row number (zero based) of the cell.

Type: Number

Cell.Column property

Gets column number (zero based) of the cell.

Type: Number

Cell.IsFormula property

Represents if the specified cell contains formula.

Type: boolean

Cell.HasCustomFunction property

Type: boolean

Cell.Type property

Represents cell value type. The value of the property is CellValueType integer constant.

Type: Number

Cell.Name property

Gets the name of the cell. 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.

Type: String

Cell.IsErrorValue property

Checks if the value of this cell is an error. Also applies to formula cell to check whether the calculated result is an error.

Type: boolean

Cell.IsNumericValue property

Indicates whether the value of this cell is numeric(int, double and datetime) Also applies to formula cell to check the calculated result

Type: boolean

Cell.StringValue property

Gets the string value contained in the cell. If the type of this cell is string, then return the string value itself. For other cell types, the formatted string value (formatted with the specified style of this cell) will be returned. The formatted cell value is same with what you can get from excel when copying a cell as text(such as copying cell to text editor or exporting to csv).

Type: String

Cell.StringValueWithoutFormat property

Gets cell’s value as string without any format. 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.

Type: String

Cell.NumberCategoryType property

Represents the category type of this cell’s number formatting. The value of the property is NumberCategoryType integer constant. When cell’s formatting pattern is combined with conditional formatting patterns, then the returned type is corresponding to the part which is used for current value of this cell. For example, if the formatting pattern for this cell is “#,##0;(#,##0);”-";@", then when cell’s value is numeric and not 0, the returned type is NumberCategoryType.NUMBER ; When cell’s value is 0 or not numeric value, the returned type is NumberCategoryType.TEXT .

Type: Number

Cell.DisplayStringValue property

Gets the formatted string value of this cell by cell’s display style.

Type: String

Cell.IntValue property

Gets the integer value contained in the cell.

Type: Number

Cell.DoubleValue property

Gets the double value contained in the cell.

Type: Number

Cell.FloatValue property

Gets the float value contained in the cell.

Type: Number

Cell.BoolValue property

Gets the boolean value contained in the cell.

Type: boolean

Cell.HasCustomStyle property

Indicates whether this cell has custom style settings(different from the default one inherited from corresponding row, column, or workbook).

Type: boolean

Cell.SharedStyleIndex property

Gets cell’s shared style index in the style pool.

Type: Number

Cell.Formula property

Gets or sets a formula of the Cell . A formula string always begins with an equal sign (=). And please always use comma(,) as parameters delimiter, such as “=SUM(A1, E1, H2)”.

Type: String

Cell.FormulaLocal property

Get the locale formatted formula of the cell.

Type: String

Cell.R1C1Formula property

Gets or sets a R1C1 formula of the Cell .

Type: String

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

Type: boolean

Cell.IsArrayHeader property

Indicates the cell’s formula is an array formula and it is the first cell of the array.

Type: boolean

Cell.IsDynamicArrayFormula property

Indicates whether the cell’s formula is dynamic array formula(true) or legacy array formula(false).

Type: boolean

Cell.IsArrayFormula property

Indicates whether the cell formula is an array formula.

Type: boolean

Cell.IsInArray property

Indicates whether the cell formula is an array formula. 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.

Type: boolean

Cell.IsSharedFormula property

Indicates whether the cell formula is part of shared formula.

Type: boolean

Cell.IsTableFormula property

Indicates whether this cell is part of table formula.

Type: boolean

Cell.IsInTable property

Indicates whether this cell is part of table formula. 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.

Type: boolean

Cell.Value property

Gets/sets the value contained in this cell. 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.

Type: Object

Cell.IsStyleSet property

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

Type: boolean

Cell.IsMerged property

Checks if a cell is part of a merged range or not.

Type: boolean

Cell.Comment property

Gets the comment of this cell. If there is no comment applies to the cell, returns null.

Type: Comment

Cell.HtmlString property

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

Type: String

Cell.IsCheckBoxStyle property

Type: boolean

Cell.EmbeddedImage property

Gets and sets the embeddedn image in the cell.

Type: byte[]

getArrayRange()

Gets the array range if the cell’s formula is an array formula.

Only applies when the cell’s formula is an array formula

Returns: The array range.

setDynamicArrayFormula(arrayFormula, options, calculateValue) (1 of 3)

Sets dynamic array formula and make the formula spill into neighboring cells if possible.

the returned range may be not same with the actual one that this dynamic array formula spills into. If there are non-empty cells in the range, the formula will be set for current cell only and marked as “#SPILL!”. But for such kind of situation we still return the whole range that this formula should spill into.

ParameterTypeDescription
arrayFormulaStringthe formula expression
optionsFormulaParseOptionsoptions to parse formula. “Parse” option will be ignored and the formula will always be parsed immediately
calculateValuebooleanwhether calculate this dynamic array formula for those cells in the spilled range.

Returns: the range that the formula should spill into.


setDynamicArrayFormula(arrayFormula, options, values, calculateRange, calculateValue) (2 of 3)

Sets dynamic array formula and make the formula spill into neighboring cells if possible.

the returned range may be not same with the actual one that this dynamic array formula spills into. If there are non-empty cells in the range, the formula will be set for current cell only and marked as “#SPILL!”. But for such kind of situation we still return the whole range that this formula should spill into.

ParameterTypeDescription
arrayFormulaStringthe formula expression
optionsFormulaParseOptionsoptions to parse formula. “Parse” option will be ignored and the formula will always be parsed immediately
valuesObject[][]values(calculated results) for those cells with given dynamic array formula
calculateRangebooleanWhether 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.
calculateValuebooleanwhether 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.

Returns: the range that the formula should spill into.


setDynamicArrayFormula(arrayFormula, options, values, calculateRange, calculateValue, copts) (3 of 3)

Sets dynamic array formula and make the formula spill into neighboring cells if possible.

the returned range may be not same with the actual one that this dynamic array formula spills into. If there are non-empty cells in the range, the formula will be set for current cell only and marked as “#SPILL!”. But for such kind of situation we still return the whole range that this formula should spill into.

ParameterTypeDescription
arrayFormulaStringthe formula expression
optionsFormulaParseOptionsoptions to parse formula. “Parse” option will be ignored and the formula will always be parsed immediately
valuesObject[][]values(calculated results) for those cells with given dynamic array formula
calculateRangebooleanWhether 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.
calculateValuebooleanwhether 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.
coptsCalculationOptionsThe options for calculating formula. Commonly, for performance consideration, the CalculationOptions.Recursive property should be false.

Returns: the range that the formula should spill into.

setTableFormula(rowNumber, columnNumber, rowInputCell, columnInputCell, values) (1 of 4)

Create two-variable data table for given range starting from this cell.

ParameterTypeDescription
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
rowInputCellStringthe row input cell
columnInputCellStringthe column input cell
valuesObject[][]values for cells in table formula range

setTableFormula(rowNumber, columnNumber, inputCell, isRowInput, values) (2 of 4)

Create one-variable data table for given range starting from this cell.

ParameterTypeDescription
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
inputCellStringthe input cell
isRowInputbooleanIndicates whether the input cell is a row input cell(true) or a column input cell(false).
valuesObject[][]values for cells in table formula range

setTableFormula(rowNumber, columnNumber, rowIndexOfRowInputCell, columnIndexOfRowInputCell, rowIndexOfColumnInputCell, columnIndexOfColumnInputCell, values) (3 of 4)

Create two-variable data table for given range starting from this cell.

ParameterTypeDescription
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
rowIndexOfRowInputCellNumberrow index of the row input cell
columnIndexOfRowInputCellNumbercolumn index of the row input cell
rowIndexOfColumnInputCellNumberrow index of the column input cell
columnIndexOfColumnInputCellNumbercolumn index of the column input cell
valuesObject[][]values for cells in table formula range

setTableFormula(rowNumber, columnNumber, rowIndexOfInputCell, columnIndexOfInputCell, isRowInput, values) (4 of 4)

Create one-variable data table for given range starting from this cell.

ParameterTypeDescription
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
rowIndexOfInputCellNumberrow index of the input cell
columnIndexOfInputCellNumbercolumn index of the input cell
isRowInputbooleanIndicates whether the input cell is a row input cell(true) or a column input cell(false).
valuesObject[][]values for cells in table formula range

removeArrayFormula(leaveNormalFormula)

Remove array formula.

ParameterTypeDescription
leaveNormalFormulabooleanTrue represents converting the array formula to normal formula.

copy(cell)

Copies data from a source cell.

ParameterTypeDescription
cellCellSource Cell object.

characters(startIndex, length)

Returns a Characters object that represents a range of characters within the cell text.

This method only works on cell with string value.

ParameterTypeDescription
startIndexNumberThe index of the start of the character.
lengthNumberThe number of characters.

Returns: Characters object.

Example:

$workbook = new cells\Workbook();
$cell = $workbook->getWorksheets()->get(0)->getCells()->get("A1");
$cell->putValue("Helloworld");
$cell->characters(5, 5)->getFont()->setBold(true);
$cell->characters(5, 5)->getFont()->setColor(cells\Color::getBlue());

replace(placeHolder, newValue, options)

Replace text of the cell with options.

ParameterTypeDescription
placeHolderStringCell placeholder
newValueStringString value to replace
optionsReplaceOptionsThe replace options

insertText(index, text)

Insert some characters to the cell. If the cell is rich formatted, this method could keep the original formatting.

ParameterTypeDescription
indexNumberThe index.
textStringInserted text.

isRichText()

Indicates whether the string value of this cell is a rich formatted text.

getCharacters() (1 of 2)

Returns all Characters objects that represents a range of characters within the cell text.

Returns: All Characters objects


getCharacters(flag) (2 of 2)

Returns all Characters objects that represents a range of characters within the cell text.

ParameterTypeDescription
flagbooleanIndicates whether applying table style to the cell if the cell is in the table.

Returns: All Characters objects

setCharacters(characters)

Sets rich text format of the cell.

ParameterTypeDescription
charactersFontSetting[]All Characters objects.

getMergedRange()

Returns a Range object which represents a merged range.

Returns: Range object. Null if this cell is not merged.

getHtmlString(html5)

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

ParameterTypeDescription
html5booleanIndicates whether the value is compatible for html5

toString()

Returns a string represents the current Cell object.

toJson()

Convert Cell to JSON struct data.

equals(obj) (1 of 2)

Checks whether this object refers to the same cell with another.

ParameterTypeDescription
objObjectanother object

Returns: true if two objects refers to the same cell.


equals(cell) (2 of 2)

Checks whether this object refers to the same cell with another cell object.

ParameterTypeDescription
cellCellanother cell object

Returns: true if two cell objects refers to the same cell.

hashCode()

Serves as a hash function for a particular type.

Returns: A hash code for current Cell object.

getConditionalFormattingResult()

Get the result of the conditional formatting.

Returns null if no conditional formatting is applied to this cell,

getValidation()

Gets the validation applied to this cell.

getValidationValue()

Gets the value of validation which applied to this cell.

getTable()

Gets the table which contains this cell.

getRichValue()

calculate(options)

Calculates the formula of the cell.

ParameterTypeDescription
optionsCalculationOptionsOptions for calculation

putValue(boolValue) (1 of 8)

Puts a boolean value into the cell.

ParameterTypeDescription
boolValueboolean

putValue(intValue) (2 of 8)

Puts an integer value into the cell.

ParameterTypeDescription
intValueNumberInput value

putValue(doubleValue) (3 of 8)

Puts a double value into the cell.

ParameterTypeDescription
doubleValueNumberInput value

putValue(stringValue, isConverted, setStyle) (4 of 8)

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.

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

putValue(stringValue, isConverted) (5 of 8)

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

ParameterTypeDescription
stringValueStringInput value
isConvertedbooleanTrue: converted to other data type if appropriate.

putValue(stringValue) (6 of 8)

Puts a string value into the cell.

ParameterTypeDescription
stringValueStringInput value

putValue(dateTime) (7 of 8)

Puts a DateTime value into the cell.

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.

ParameterTypeDescription
dateTimeDateTimeInput value

putValue(objectValue) (8 of 8)

Puts an object value into the cell.

ParameterTypeDescription
objectValueObjectinput value

getStringValue(formatStrategy)

Gets the string value by specific formatted strategy.

ParameterTypeDescription
formatStrategyNumberA CellValueFormatStrategy value. The formatted strategy.

getWidthOfValue()

Gets the width of the value in unit of pixels.

getHeightOfValue()

Gets the height of the value in unit of pixels.

getDisplayStyle() (1 of 3)

Gets the display style of the cell. If this cell is also affected by other settings such as conditional formatting, list objects, etc., then the display style may be different from cell.GetStyle().


getDisplayStyle(includeMergedBorders) (2 of 3)

Gets the display style of the cell. If the cell is conditional formatted, the display style is not same as the cell.GetStyle().

ParameterTypeDescription
includeMergedBordersbooleanIndicates whether checking borders of the merged cells.

getDisplayStyle(adjacentBorders) (3 of 3)

getFormatConditions()

Gets format conditions which applies to this cell.

Returns: Returns FormatConditionCollection object

getStyle() (1 of 2)

Gets the cell style.

To change the style of the cell, please call Cell.SetStyle() method after modifying the returned style object. This method is same with getStyle(boolean) with true value for the parameter.

Returns: Style object.


getStyle(checkBorders) (2 of 2)

If checkBorders is true, check whether other cells’ borders will effect the style of this cell.

ParameterTypeDescription
checkBordersbooleanCheck other cells’ borders

Returns: Style object.

setStyle(style) (1 of 3)

Sets the cell style.

If the border settings are changed, the border of adjust cells will be updated too.

ParameterTypeDescription
styleStyleThe cell style.

setStyle(style, explicitFlag) (2 of 3)

Apply the changed property of style to the cell.

ParameterTypeDescription
styleStyleThe cell style.
explicitFlagbooleanTrue, only overwriting formatting which is explicitly set.

setStyle(style, flag) (3 of 3)

Apply the cell style based on flags.

ParameterTypeDescription
styleStyleThe cell style.
flagStyleFlagThe style flag.

setFormula(formula, value) (1 of 4)

Set the formula and the value(calculated result) of the formula.

ParameterTypeDescription
formulaStringThe formula.
valueObjectThe value(calculated result) of the formula.

setFormula(formula, options) (2 of 4)


setFormula(formula, isR1C1, isLocal, value) (3 of 4)

Set the formula and the value of the formula.

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.

ParameterTypeDescription
formulaStringThe formula.
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.
valueObjectThe value of the formula.

setFormula(formula, options, value) (4 of 4)

Set the formula and the value(calculated result) of the formula.

ParameterTypeDescription
formulaStringThe formula.
optionsFormulaParseOptionsOptions for parsing the formula.
valueObjectThe value(calculated result) of the formula.

getFormula(isR1C1, isLocal)

Get the formula of this cell.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: the formula of this cell.

setArrayFormula(arrayFormula, rowNumber, columnNumber, isR1C1, isLocal) (1 of 4)

Sets an array formula to a range of cells.

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.

ParameterTypeDescription
arrayFormulaStringArray formula.
rowNumberNumberNumber of rows to populate result of the array formula.
columnNumberNumberNumber of columns to populate result of the array formula.
isR1C1booleanwhether the formula is R1C1 formula
isLocalbooleanwhether the formula is locale formatted

setArrayFormula(arrayFormula, rowNumber, columnNumber) (2 of 4)

Sets an array formula(legacy array formula entered via CTRL+SHIFT+ENTER in ms excel) to a range of cells.

ParameterTypeDescription
arrayFormulaStringArray formula.
rowNumberNumberNumber of rows to populate result of the array formula.
columnNumberNumberNumber of columns to populate result of the array formula.

setArrayFormula(arrayFormula, rowNumber, columnNumber, options) (3 of 4)

Sets an array formula to a range of cells.

ParameterTypeDescription
arrayFormulaStringArray formula.
rowNumberNumberNumber of rows to populate result of the array formula.
columnNumberNumberNumber of columns to populate result of the array formula.
optionsFormulaParseOptionsOptions for parsing the formula.

setArrayFormula(arrayFormula, rowNumber, columnNumber, options, values) (4 of 4)

Sets an array formula to a range of cells.

ParameterTypeDescription
arrayFormulaStringArray formula.
rowNumberNumberNumber of rows to populate result of the array formula.
columnNumberNumberNumber of columns to populate result of the array formula.
optionsFormulaParseOptionsOptions for parsing the formula.
valuesObject[][]values for those cells with given array formula

setSharedFormula(sharedFormula, rowNumber, columnNumber, isR1C1, isLocal) (1 of 4)

Sets a formula to a range of cells.

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.

ParameterTypeDescription
sharedFormulaStringShared formula.
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
isR1C1booleanwhether the formula is R1C1 formula
isLocalbooleanwhether the formula is locale formatted

setSharedFormula(sharedFormula, rowNumber, columnNumber) (2 of 4)

Sets shared formulas to a range of cells.

ParameterTypeDescription
sharedFormulaStringShared formula.
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.

setSharedFormula(sharedFormula, rowNumber, columnNumber, options) (3 of 4)

Sets shared formulas to a range of cells.

ParameterTypeDescription
sharedFormulaStringShared formula.
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
optionsFormulaParseOptionsOptions for parsing the formula.

setSharedFormula(sharedFormula, rowNumber, columnNumber, options, values) (4 of 4)

Sets shared formulas to a range of cells.

ParameterTypeDescription
sharedFormulaStringShared formula.
rowNumberNumberNumber of rows to populate the formula.
columnNumberNumberNumber of columns to populate the formula.
optionsFormulaParseOptionsOptions for parsing the formula.
valuesObject[][]values for those cells with given shared formula

getPrecedents()

Gets all references appearing in this cell’s formula.

Returns null if this is not a formula cell. All references appearing in this cell’s formula will be returned no matter they are referenced or not while calculating. For example, although cell A2 in formula “=IF(TRUE,A1,A2)” is not used while calculating, it is still taken as the formula’s precedents. To get those references which influence the calculation only, please use getPrecedentsInCalculation() .

Returns: Collection of all references appearing in this cell’s formula.

Example:

$workbook = new cells\Workbook();
$cells = $workbook->getWorksheets()->get(0)->getCells();
$cells->get("A1")->setFormula("= B1 + SUM(B1:B10) + [Book1.xls]Sheet1!A1");
$areas =$cells->get("A1")->getPrecedents();
for ($i = 0; $i < java_values($areas->getCount()); $i++)
{
    $area = $areas->get($i);
    $stringBuilder = "";
    if (java_values($area->isExternalLink()))
    {
        $stringBuilder .= "[";
        $stringBuilder .= $area->getExternalFileName();
        $stringBuilder .= "]";
    }
    $stringBuilder .= $area->getSheetName();
    $stringBuilder .= "!";
    $stringBuilder .= cells\CellsHelper::cellIndexToName($area->getStartRow(), $area->getStartColumn());
    if (java_values($area->isArea()))
    {
        $stringBuilder .= ":";
        $stringBuilder .= cells\CellsHelper::cellIndexToName($area->getEndRow(), $area->getEndColumn());
    }
    echo "Precedent ".$i.": ".$stringBuilder."\n";
}

getDependents(isAll)

Get all cells whose formula references to this cell directly.

If one reference containing this cell appears in one cell’s formula, that cell will be taken as the dependent of this cell, no matter the reference or this cell is used or not while calculating. For example, although cell A2 in formula “=IF(TRUE,A1,A2)” is not used while calculating, this formula is still be taken as A2’s dependent. To get those formulas whose calculated results depend on this cell, please use getDependentsInCalculation(boolean) . When tracing dependents for one cell, all formulas in the workbook or worksheet will be analized and checked. So it is a time consumed process. If user need to trace dependents for lots of cells, using this method will cause poor performance. For performance consideration, user should use getDependentsInCalculation(boolean) instead. Or, user may gather precedents map of all cells by getPrecedents() firstly, and then build the dependents map according to the precedents map.

ParameterTypeDescription
isAllbooleanIndicates whether check formulas in other worksheets

getPrecedentsInCalculation()

Gets all precedents(reference to cells in current workbook) used by this cell’s formula while calculating it.

This method can only work with the situation that FormulaSettings.EnableCalculationChain 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.

Returns: Enumerator to enumerate all references(ReferredArea)

getDependentsInCalculation(recursive)

Gets all cells whose calculated result depends on this cell.

To use this method, please make sure the workbook has been set with true value for FormulaSettings.EnableCalculationChain and has been fully calculated with this setting. If there is no formula reference to this cell, null will be returned.

ParameterTypeDescription
recursivebooleanWhether returns those dependents which do not reference to this cell directly but reference to other leafs of this cell

Returns: Enumerator to enumerate all dependents(Cell objects)

getLeafs() (1 of 2)

Get all cells which reference to this cell directly and need to be updated when this cell is modified.

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.

Returns: Enumerator to enumerate all dependents(Cell)


getLeafs(recursive) (2 of 2)

Get all cells which will be updated when this cell is modified.

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.

ParameterTypeDescription
recursivebooleanWhether returns those leafs that do not reference to this cell directly but reference to other leafs of this cell

Returns: Enumerator to enumerate all dependents(Cell)