asposecells.api

Encapsulates the object that represents a single Workbook cell.

Example:

excel = Workbook()
cells = excel.getWorksheets().get(0).getCells()

# Put a string into a cell
cell = cells.get(0, 0)
cell.putValue("Hello")
first = cell.getStringValue()
# Put an integer into a cell
cell = cells.get("B1")
cell.putValue(12)
second = cell.getIntValue()
# Put a double into a cell
cell = cells.get(0, 2)
cell.putValue(-1.234)
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 = 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)

Property Getters/Setters Summary
methodgetBoolValue()
Gets the boolean value contained in the cell.
methodgetColumn()
Gets column number (zero based) of the cell.
methodgetComment()
Gets the comment of this cell.
methodcontainsExternalLink()
Indicates whether this cell contains an external link. Only applies when the cell is a formula cell.
methodgetDateTimeValue()
Gets the DateTime value contained in the cell.
methodgetDisplayStringValue()
Gets the formatted string value of this cell by cell's display style.
methodgetDoubleValue()
Gets the double value contained in the cell.
methodgetFloatValue()
Gets the float value contained in the cell.
methodgetFormula()
method
setFormula(value)
           Gets or sets a formula of the Cell.
methodgetFormulaLocal()
method
           Get the locale formatted formula of the cell.
methodgetHtmlString()
method
           Gets and sets the html string which contains data and some formats in this cell.
methodgetIntValue()
Gets the integer value contained in the cell.
methodisArrayFormula()
Indicates whether the cell formula is an array formula.
methodisArrayHeader()
Indicates the cell's formula is and array formula and it is the first cell of the array.
methodisErrorValue()
Checks if a formula can properly evaluate a result.
methodisFormula()
Represents if the specified cell contains formula.
methodisInArray()
Indicates whether the cell formula is an array formula.
methodisInTable()
Indicates whether this cell is part of table formula.
methodisMerged()
Checks if a cell is part of a merged range or not.
methodisNumericValue()
Indicates whether the inner value of this cell is numeric(int, double and datetime)
methodisSharedFormula()
Indicates whether the cell formula is part of shared formula.
methodisStyleSet()
Indicates if the cell's style is set. If return false, it means this cell has a default cell format.
methodisTableFormula()
Indicates whether this cell is part of table formula.
methodgetName()
Gets the name of the cell.
methodgetNumberCategoryType()
Represents the category type of this cell's number formatting. The value of the property is NumberCategoryType integer constant.
methodgetR1C1Formula()
method
           Gets or sets a R1C1 formula of the Cell.
methodgetRow()
Gets row number (zero based) of the cell.
methodgetSharedStyleIndex()
Gets cell's shared style index in the style pool.
methodgetStringValue()
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).
methodgetStringValueWithoutFormat()
Gets cell's value as string without any format.
methodgetType()
Represents cell value type. The value of the property is CellValueType integer constant.
methodgetValue()
method
setValue(value)
           Gets the value contained in this cell.
methodgetWorksheet()
Gets the parent worksheet.
 
Method Summary
methodcalculate(options)
Calculates the formula of the cell.
methodcharacters(startIndex, length)
Returns a Characters object that represents a range of characters within the cell text.
methodcopy(cell)
Copies data from a source cell.
methodequals(cell)
Checks whether this object refers to the same cell with another cell object.
methodequals(obj)
Checks whether this object refers to the same cell with another.
methodgetArrayRange()
Gets the array range if the cell's formula is an array formula.
methodgetCharacters()
Returns all Characters objects that represents a range of characters within the cell text.
methodgetCharacters(flag)
Returns all Characters objects that represents a range of characters within the cell text.
methodgetConditionalFormattingResult()
Get the result of the conditional formatting.
methodgetDependents(isAll)
Get all cells which reference to the specific cell.
methodgetDisplayStyle()
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().
methodgetDisplayStyle(includeMergedBorders)
Gets the display style of the cell. If the cell is conditional formatted, the display style is not same as the cell.GetStyle().
methodgetFormatConditions()
Gets format conditions which applies to this cell.
methodgetFormula(isR1C1, isLocal)
Get the formula of this cell.
methodgetHeightOfValue()
Gets the height of the value in unit of pixels.
methodgetHtmlString(html5)
Gets the html string which contains data and some formats in this cell.
methodgetLeafs()
Get all cells which reference to this cell directly and need to be updated when this cell is modified.
methodgetLeafs(recursive)
Get all cells which will be updated when this cell is modified.
methodgetMergedRange()
Returns a Range object which represents a merged range.
methodgetPrecedents()
Gets all cells or ranges which this cell's formula depends on.
methodgetStringValue(formatStrategy)
Gets the string value by specific formatted strategy.
methodgetStyle()
Gets the cell style.
methodgetStyle(checkBorders)
If checkBorders is true, check whether other cells' borders will effect the style of this cell.
methodgetTable()
Gets the table which contains this cell.
methodgetValidation()
Gets the validation applied to this cell.
methodgetValidationValue()
Gets the value of validation which applied to this cell.
methodgetWidthOfValue()
Gets the width of the value in unit of pixels.
methodhashCode()
Serves as a hash function for a particular type.
methodisRichText()
Indicates whether the cell string value is a rich text.
methodputValue(boolValue)
Puts a boolean value into the cell.
methodputValue(dateTime)
Puts a DateTime value into the cell.
methodputValue(doubleValue)
Puts a double value into the cell.
methodputValue(intValue)
Puts an integer value into the cell.
methodputValue(objectValue)
Puts an object value into the cell.
methodputValue(stringValue)
Puts a string value into the cell.
methodputValue(stringValue, isConverted)
Puts a string value into the cell and converts the value to other data type if appropriate.
methodputValue(stringValue, isConverted, 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.
methodremoveArrayFormula(leaveNormalFormula)
Remove array formula.
methodsetArrayFormula(arrayFormula, rowNumber, columnNumber)
Sets an array formula(legacy array formula entered via CTRL+SHIFT+ENTER in ms excel) to a range of cells.
methodsetArrayFormula(arrayFormula, rowNumber, columnNumber, isR1C1, isLocal)
Sets an array formula to a range of cells.
methodsetArrayFormula(arrayFormula, rowNumber, columnNumber, options)
Sets an array formula to a range of cells.
methodsetArrayFormula(arrayFormula, rowNumber, columnNumber, options, values)
Sets an array formula to a range of cells.
methodsetCharacters(characters)
Sets rich text format of the cell.
methodsetDynamicArrayFormula(arrayFormula, options, calculateValue)
Sets dynamic array formula and make the formula spill into neighboring cells if possible.
methodsetDynamicArrayFormula(arrayFormula, options, values, calculateRange, calculateValue)
Sets dynamic array formula and make the formula spill into neighboring cells if possible.
methodsetFormula(formula, isR1C1, isLocal, value)
Set the formula and the value of the formula.
methodsetFormula(formula, options, value)
Set the formula and the value of the formula.
methodsetFormula(formula, value)
Set the formula and the value of the formula.
methodsetSharedFormula(sharedFormula, rowNumber, columnNumber)
Sets a formula to a range of cells.
methodsetSharedFormula(sharedFormula, rowNumber, columnNumber, isR1C1, isLocal)
Sets a formula to a range of cells.
methodsetSharedFormula(sharedFormula, rowNumber, columnNumber, options)
Sets a formula to a range of cells.
methodsetSharedFormula(sharedFormula, rowNumber, columnNumber, options, values)
Sets a formula to a range of cells.
methodsetStyle(style)
Sets the cell style.
methodsetStyle(style, explicitFlag)
Apply the cell style.
methodsetStyle(style, flag)
Apply the cell style.
methodtoString()
Returns a string represents the current Cell object.
 

    • Property Getters/Setters Detail

      • getDateTimeValue : DateTime 

        DateTime getDateTimeValue()
        
        Gets the DateTime value contained in the cell.
      • getRow : int 

        int getRow()
        
        Gets row number (zero based) of the cell. Cell row number
      • getColumn : int 

        int getColumn()
        
        Gets column number (zero based) of the cell.
      • isFormula : boolean 

        boolean isFormula()
        
        Represents if the specified cell contains formula.
      • getType : int 

        int getType()
        
        Represents cell value type. The value of the property is CellValueType integer constant.
      • getName : String 

        String getName()
        
        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.
      • isErrorValue : boolean 

        boolean isErrorValue()
        
        Checks if a formula can properly evaluate a result. Also applies to formula cell to check the calculated result
      • isNumericValue : boolean 

        boolean isNumericValue()
        
        Indicates whether the inner value of this cell is numeric(int, double and datetime) Also applies to formula cell to check the calculated result
      • getStringValue : String 

        String getStringValue()
        
        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).
      • getStringValueWithoutFormat : String 

        String getStringValueWithoutFormat()
        
        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.
      • getNumberCategoryType : int 

        int getNumberCategoryType()
        
        Represents the category type of this cell's number formatting. The value of the property is NumberCategoryType integer constant.
      • getDisplayStringValue : String 

        String getDisplayStringValue()
        
        Gets the formatted string value of this cell by cell's display style.
      • getIntValue : int 

        int getIntValue()
        
        Gets the integer value contained in the cell.
      • getDoubleValue : float 

        float getDoubleValue()
        
        Gets the double value contained in the cell.
      • getFloatValue : float 

        float getFloatValue()
        
        Gets the float value contained in the cell.
      • getBoolValue : boolean 

        boolean getBoolValue()
        
        Gets the boolean value contained in the cell.
      • getSharedStyleIndex : int 

        int getSharedStyleIndex()
        
        Gets cell's shared style index in the style pool.
      • getFormula/setFormula : String 

        String getFormula() / setFormula(value)
        
        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)".

        Example:

        excel = Workbook()
        cells = excel.getWorksheets().get(0).getCells()
        cells.get("B6").setFormula("=SUM(B2:B5, E1) + sheet2!A1")
      • getFormulaLocal/setFormulaLocal : String 

        String getFormulaLocal() / setFormulaLocal(value)
        
        Get the locale formatted formula of the cell.
      • getR1C1Formula/setR1C1Formula : String 

        String getR1C1Formula() / setR1C1Formula(value)
        
        Gets or sets a R1C1 formula of the Cell.
      • containsExternalLink : boolean 

        boolean containsExternalLink()
        
        Indicates whether this cell contains an external link. Only applies when the cell is a formula cell.
      • isArrayHeader : boolean 

        boolean isArrayHeader()
        
        Indicates the cell's formula is and array formula and it is the first cell of the array.
      • isArrayFormula : boolean 

        boolean isArrayFormula()
        
        Indicates whether the cell formula is an array formula.
      • isInArray : boolean 

        boolean isInArray()
        
        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.
      • isSharedFormula : boolean 

        boolean isSharedFormula()
        
        Indicates whether the cell formula is part of shared formula.
      • isTableFormula : boolean 

        boolean isTableFormula()
        
        Indicates whether this cell is part of table formula.
      • isInTable : boolean 

        boolean isInTable()
        
        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.
      • getValue/setValue : Object 

        Object getValue() / setValue(value)
        
        Gets 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.
      • isStyleSet : boolean 

        boolean isStyleSet()
        
        Indicates if the cell's style is set. If return false, it means this cell has a default cell format.
      • isMerged : boolean 

        boolean isMerged()
        
        Checks if a cell is part of a merged range or not.
      • getComment : Comment 

        Comment getComment()
        
        Gets the comment of this cell. If there is no comment applies to the cell, returns null.
      • getHtmlString/setHtmlString : String 

        String getHtmlString() / setHtmlString(value)
        
        Gets and sets the html string which contains data and some formats in this cell.
    • Method Detail

      • setDynamicArrayFormula

        CellArea setDynamicArrayFormula(arrayFormula, options, calculateValue)
        Sets dynamic array formula and make the formula spill into neighboring cells if possible.
        Parameters:
        arrayFormula: String - the formula expression
        options: FormulaParseOptions - options to parse formula. "Parse" option will be ignored and the formula will always be parsed immediately
        calculateValue: boolean - whether calculate this dynamic array formula for those cells in the spilled range.
        Returns:
        the range that the formula should spill into.
      • setDynamicArrayFormula

        CellArea setDynamicArrayFormula(arrayFormula, options, values, calculateRange, calculateValue)
        Sets dynamic array formula and make the formula spill into neighboring cells if possible.
        Parameters:
        arrayFormula: String - the formula expression
        options: FormulaParseOptions - options to parse formula. "Parse" option will be ignored and the formula will always be parsed immediately
        values: Object[][] - values for those cells with given dynamic array formula
        calculateRange: boolean - 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: boolean - 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.
        Returns:
        the range that the formula should spill into.
      • setArrayFormula

         setArrayFormula(arrayFormula, rowNumber, columnNumber)
        Sets an array formula(legacy array formula entered via CTRL+SHIFT+ENTER in ms excel) to a range of cells.
        Parameters:
        arrayFormula: String - Array formula.
        rowNumber: int - Number of rows to populate result of the array formula.
        columnNumber: int - Number of columns to populate result of the array formula.
      • setSharedFormula

         setSharedFormula(sharedFormula, rowNumber, columnNumber)
        Sets a formula to a range of cells.
        Parameters:
        sharedFormula: String - Shared formula.
        rowNumber: int - Number of rows to populate the formula.
        columnNumber: int - Number of columns to populate the formula.
      • removeArrayFormula

         removeArrayFormula(leaveNormalFormula)
        Remove array formula.
        Parameters:
        leaveNormalFormula: boolean - True represents converting the array formula to normal formula.
      • copy

         copy(cell)
        Copies data from a source cell.
        Parameters:
        cell: Cell - Source Cell object.
      • characters

        FontSetting 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.
        Parameters:
        startIndex: int - The index of the start of the character.
        length: int - The number of characters.
        Returns:
        Characters object.

        Example:

        excel = Workbook()
        excel.getWorksheets().get(0).getCells().get("A1").putValue("Helloworld")
        excel.getWorksheets().get(0).getCells().get("A1").characters(5, 5).getFont().setBold(True)
        excel.getWorksheets().get(0).getCells().get("A1").characters(5, 5).getFont().setColor(Color.getBlue())
      • isRichText

        boolean isRichText()
        Indicates whether the cell string value is a rich text.
      • getCharacters

        FontSetting[] getCharacters()
        Returns all Characters objects that represents a range of characters within the cell text.
        Returns:
        All Characters objects
      • getCharacters

        FontSetting[] getCharacters(flag)
        Returns all Characters objects that represents a range of characters within the cell text.
        Parameters:
        flag: boolean - Indicates whether applying table style to the cell if the cell is in the table.
        Returns:
        All Characters objects
      • setCharacters

         setCharacters(characters)
        Sets rich text format of the cell.
        Parameters:
        characters: FontSetting[] - All Characters objects.
      • getMergedRange

        Range getMergedRange()
        Returns a Range object which represents a merged range.
        Returns:
        Range object. Null if this cell is not merged.
      • getHtmlString

        String getHtmlString(html5)
        Gets the html string which contains data and some formats in this cell.
        Parameters:
        html5: boolean - Indicates whether the value is compatible for html5
        Returns:
      • toString

        String toString()
        Returns a string represents the current Cell object.
        Returns:
      • equals

        boolean equals(obj)
        Checks whether this object refers to the same cell with another.
        Parameters:
        obj: Object - another object
        Returns:
        true if two objects refers to the same cell.
      • hashCode

        int hashCode()
        Serves as a hash function for a particular type.
        Returns:
        A hash code for current Cell object.
      • equals

        boolean equals(cell)
        Checks whether this object refers to the same cell with another cell object.
        Parameters:
        cell: Cell - another cell object
        Returns:
        true if two cell objects refers to the same cell.
      • getConditionalFormattingResult

        ConditionalFormattingResult getConditionalFormattingResult()
        Get the result of the conditional formatting. Returns null if no conditional formatting is applied to this cell,
      • getValidation

        Validation getValidation()
        Gets the validation applied to this cell.
        Returns:
      • getValidationValue

        boolean getValidationValue()
        Gets the value of validation which applied to this cell.
        Returns:
      • getTable

        ListObject getTable()
        Gets the table which contains this cell.
        Returns:
      • calculate

         calculate(options)
        Calculates the formula of the cell.
        Parameters:
        options: CalculationOptions - Options for calculation
      • putValue

         putValue(boolValue)
        Puts a boolean value into the cell.
        Parameters:
        boolValue: boolean -
      • putValue

         putValue(intValue)
        Puts an integer value into the cell.
        Parameters:
        intValue: int - Input value
      • putValue

         putValue(doubleValue)
        Puts a double value into the cell.
        Parameters:
        doubleValue: float - Input value
      • putValue

         putValue(stringValue, isConverted, 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:
        stringValue: 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
      • putValue

         putValue(stringValue, isConverted)
        Puts a string value into the cell and converts the value to other data type if appropriate.
        Parameters:
        stringValue: String - Input value
        isConverted: boolean - True: converted to other data type if appropriate.
      • putValue

         putValue(stringValue)
        Puts a string value into the cell.
        Parameters:
        stringValue: String - Input value
      • putValue

         putValue(dateTime)
        Puts a DateTime value into the cell.
        Parameters:
        dateTime: DateTime - Input value
      • putValue

         putValue(objectValue)
        Puts an object value into the cell.
        Parameters:
        objectValue: Object - input value
      • getStringValue

        String getStringValue(formatStrategy)
        Gets the string value by specific formatted strategy.
        Parameters:
        formatStrategy: int - A CellValueFormatStrategy value. The formatted strategy.
        Returns:
      • getWidthOfValue

        int getWidthOfValue()
        Gets the width of the value in unit of pixels.
        Returns:
      • getHeightOfValue

        int getHeightOfValue()
        Gets the height of the value in unit of pixels.
        Returns:
      • getDisplayStyle

        Style getDisplayStyle()
        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

        Style getDisplayStyle(includeMergedBorders)
        Gets the display style of the cell. If the cell is conditional formatted, the display style is not same as the cell.GetStyle().
        Parameters:
        includeMergedBorders: boolean - Indicates whether checking borders of the merged cells.
      • getFormatConditions

        FormatConditionCollection[] getFormatConditions()
        Gets format conditions which applies to this cell.
        Returns:
        Returns FormatConditionCollection object
      • getStyle

        Style getStyle()
        Gets the cell style. To change the style of the cell, please call Cell.SetStyle() method after changing the style.
        Returns:
        Style object.
      • getStyle

        Style getStyle(checkBorders)
        If checkBorders is true, check whether other cells' borders will effect the style of this cell.
        Parameters:
        checkBorders: boolean - Check other cells' borders
        Returns:
        Style object.
      • setStyle

         setStyle(style)
        Sets the cell style. If the border settings are changed, the border of adjust cells will be updated too.
        Parameters:
        style: Style - The cell style.
      • setStyle

         setStyle(style, explicitFlag)
        Apply the cell style.
        Parameters:
        style: Style - The cell style.
        explicitFlag: boolean - True, only overwriting formatting which is explicitly set.
      • setStyle

         setStyle(style, flag)
        Apply the cell style.
        Parameters:
        style: Style - The cell style.
        flag: StyleFlag - The style flag.
      • setFormula

         setFormula(formula, value)
        Set the formula and the value of the formula.
        Parameters:
        formula: String - The formula.
        value: Object - The value of the formula.
      • getFormula

        String getFormula(isR1C1, isLocal)
        Get the formula of this cell.
        Parameters:
        isR1C1: boolean - Whether the formula needs to be formatted as R1C1.
        isLocal: boolean - Whether the formula needs to be formatted by locale.
        Returns:
        the formula of this cell.
      • setFormula

         setFormula(formula, isR1C1, isLocal, value)
        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.
        Parameters:
        formula: String - The formula.
        isR1C1: boolean - Whether the formula is R1C1 formula.
        isLocal: boolean - Whether the formula is locale formatted.
        value: Object - The value of the formula.
      • setFormula

         setFormula(formula, options, value)
        Set the formula and the value of the formula.
        Parameters:
        formula: String - The formula.
        options: FormulaParseOptions - Options for parsing the formula.
        value: Object - The value of the formula.
      • setArrayFormula

         setArrayFormula(arrayFormula, rowNumber, columnNumber, isR1C1, isLocal)
        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.
        Parameters:
        arrayFormula: String - Array formula.
        rowNumber: int - Number of rows to populate result of the array formula.
        columnNumber: int - Number of columns to populate result of the array formula.
        isR1C1: boolean - whether the formula is R1C1 formula
        isLocal: boolean - whether the formula is locale formatted
      • setArrayFormula

         setArrayFormula(arrayFormula, rowNumber, columnNumber, options)
        Sets an array formula to a range of cells.
        Parameters:
        arrayFormula: String - Array formula.
        rowNumber: int - Number of rows to populate result of the array formula.
        columnNumber: int - Number of columns to populate result of the array formula.
        options: FormulaParseOptions - Options for parsing the formula.
      • setArrayFormula

         setArrayFormula(arrayFormula, rowNumber, columnNumber, options, values)
        Sets an array formula to a range of cells.
        Parameters:
        arrayFormula: String - Array formula.
        rowNumber: int - Number of rows to populate result of the array formula.
        columnNumber: int - Number of columns to populate result of the array formula.
        options: FormulaParseOptions - Options for parsing the formula.
        values: Object[][] - values for those cells with given array formula
      • setSharedFormula

         setSharedFormula(sharedFormula, rowNumber, columnNumber, isR1C1, isLocal)
        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.
        Parameters:
        sharedFormula: String - Shared formula.
        rowNumber: int - Number of rows to populate the formula.
        columnNumber: int - Number of columns to populate the formula.
        isR1C1: boolean - whether the formula is R1C1 formula
        isLocal: boolean - whether the formula is locale formatted
      • setSharedFormula

         setSharedFormula(sharedFormula, rowNumber, columnNumber, options)
        Sets a formula to a range of cells.
        Parameters:
        sharedFormula: String - Shared formula.
        rowNumber: int - Number of rows to populate the formula.
        columnNumber: int - Number of columns to populate the formula.
        options: FormulaParseOptions - Options for parsing the formula.
      • setSharedFormula

         setSharedFormula(sharedFormula, rowNumber, columnNumber, options, values)
        Sets a formula to a range of cells.
        Parameters:
        sharedFormula: String - Shared formula.
        rowNumber: int - Number of rows to populate the formula.
        columnNumber: int - Number of columns to populate the formula.
        options: FormulaParseOptions - Options for parsing the formula.
        values: Object[][] - values for those cells with given shared formula
      • getPrecedents

        ReferredAreaCollection getPrecedents()
        Gets all cells or ranges which this cell's formula depends on. Returns null if this is not a formula cell.
        Returns:
        Returns all cells or ranges.

        Example:

        workbook = Workbook()
        cells = workbook.getWorksheets().get(0).getCells()
        cells.get("A1").setFormula("= B1 + SUM(B1:B10) + [Book2.xlsx]Chart!B2")
        areas = cells.get("A1").getPrecedents()
        for i in range(0, areas.getCount()):
            area = areas.get(i)
            stringBuilder = ""
            if area.isExternalLink():
                stringBuilder += "["
                stringBuilder += str(area.getExternalFileName())
                stringBuilder += "]"
            stringBuilder += str(area.getSheetName())
            stringBuilder += "!"
            stringBuilder += str(CellsHelper.cellIndexToName(area.getStartRow(), area.getStartColumn()))
            if area.isArea():
                stringBuilder += ":"
                stringBuilder += str(CellsHelper.cellIndexToName(area.getEndRow(), area.getEndColumn()))
        workbook.save("Book1.xlsx")
      • getDependents

        Cell[] getDependents(isAll)
        Get all cells which reference to the specific cell.
        Parameters:
        isAll: boolean - Indicates whether check other worksheets
      • getLeafs

        Iterator getLeafs()
        Get all cells which reference to this cell directly and need to be updated when this cell is modified.
      • getLeafs

        Iterator getLeafs(recursive)
        Get all cells which will be updated when this cell is modified. This method can only work with the situation that FormulaSettings.EnableCalculationChain is true for the workbook and it has been fully calculated.
        Parameters:
        recursive: boolean - Whether returns those leafs which do not reference to this cell directly but reference to other leafs of this cell's
      • getArrayRange

        CellArea 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.