public class FormulaHandle extends Object
WorkBookHandle,
WorkSheetHandle,
CellHandle| Modifier | Constructor and Description |
|---|---|
protected |
FormulaHandle(Formula f,
WorkBook book)
Create a new FormulaHandle from an Excel Formula
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCellToRange(String formulaLoc,
CellHandle handle)
Changes a range in a formula to expand until it includes the
cell address from CellHandle.
|
Object |
calculate()
Calculate the value of the formula and return it as an object
Calling calculate will ignore the WorkBook formula calculation flags
and forces calculation of the entire formula stack
|
boolean |
changeFormulaLocation(String formulaLoc,
String newaddr)
Takes a string as a current formula location, and changes
that pointer in the formula to the new string that is sent.
|
boolean |
evaluatesToString()
If the Formula evaluates to a String, there
will be a Stringrec attached to the Formula
which contains the latest value.
|
boolean |
getCalcAlways()
return the "Calculate Always" setting for this formula
used for formulas that always need calculating such as TODAY
|
String |
getCellAddress()
Returns the cell Address of the formula
|
CellRange[] |
getCellRanges()
Initialize CellRanges referenced by this formula
|
double |
getDoubleVal()
If the Formula evaluates to a double, return
the value as an double.
|
float |
getFloatVal()
If the Formula evaluates to a float, return
the value as an float.
|
Formula |
getFormulaRec()
returns the low-level formula rec for this Formulahandle
|
String |
getFormulaString()
Returns the Human-Readable Formula String
|
int |
getIntVal()
If the Formula evaluates to an int, return
the value as an int.
|
String |
getOOXML()
generate the OOXML necessary to describe this formula
OOXML element
|
String[] |
getRanges()
get CellRange strings referenced by this formula
|
String |
getStringVal()
If the Formula evaluates to a String, return
the value as a String.
|
static String[][] |
getSupportedFunctions() |
Object |
getVal()
Return the value of the Formula
|
boolean |
isArrayFormula() |
boolean |
isErrorValue()
Utility method to determine if the calculation works out to an error value.
|
boolean |
isSharedFormula()
return truth of "this formula is shared"
|
static void |
moveCellRefs(FormulaHandle fmh,
int[] offsets)
Copy the formula references with offsets
|
void |
setCalcAlways(boolean fAlwaysCalc)
set the "Calculate Always setting for this formula
used for formulas that always need calculating such as TODAY
|
void |
setFormula(String formulaString)
Sets the formula to a string passed in excel formula format.
|
boolean |
setLocationLocked(String loc,
boolean l)
Sets the location lock on the Cell Reference at the
specified location
Used to prevent updating of the Cell Reference when
Cells are moved.
|
boolean |
setLocationPolicy(String loc,
int l)
Sets the location lock on the Cell Reference at the
specified location
Used to prevent updating of the Cell Reference when
Cells are moved.
|
String |
toString() |
public static String[][] getSupportedFunctions()
public boolean setLocationLocked(String loc, boolean l)
location - of the Cell Reference to be locked/unlockedlock - status settingpublic boolean setLocationPolicy(String loc, int l)
location - of the Cell Reference to be locked/unlockedlock - status settingpublic String getCellAddress()
public String getFormulaString()
public String getStringVal() throws FunctionNotSupportedException
FunctionNotSupportedExceptionpublic Object getVal() throws FunctionNotSupportedException
FunctionNotSupportedExceptionpublic Object calculate() throws FunctionNotSupportedException
FunctionNotSupportedExceptionpublic void setFormula(String formulaString) throws FunctionNotSupportedException
formulaString - - String formatted as an excel formula, like Sum(A3+4)FunctionNotSupportedExceptionpublic boolean evaluatesToString()
public float getFloatVal()
throws FunctionNotSupportedException
FunctionNotSupportedExceptionpublic double getDoubleVal()
throws FunctionNotSupportedException
FunctionNotSupportedExceptionpublic int getIntVal()
throws FunctionNotSupportedException
FunctionNotSupportedExceptionpublic String[] getRanges() throws FormulaNotFoundException
FormulaNotFoundExceptionpublic CellRange[] getCellRanges() throws FormulaNotFoundException
FormulaNotFoundExceptionpublic boolean changeFormulaLocation(String formulaLoc, String newaddr) throws FormulaNotFoundException
String - - range of Cells within Formula to modifyString - - new range of Cells within FormulaFormulaNotFoundExceptionpublic boolean addCellToRange(String formulaLoc, CellHandle handle) throws FormulaNotFoundException
String - - the Cell Range as a String to add the Cell toCellHandle - - the CellHandle to add to the rangeFormulaNotFoundExceptionpublic static void moveCellRefs(FormulaHandle fmh, int[] offsets) throws FormulaNotFoundException
int[row,col] - offsets to move the referencesFormulaNotFoundExceptionpublic boolean isSharedFormula()
public boolean isArrayFormula()
public Formula getFormulaRec()
public boolean isErrorValue()
public boolean getCalcAlways()
public void setCalcAlways(boolean fAlwaysCalc)
fAlwaysCalc - public String getOOXML()
Copyright © 2002–2019 Starter Inc.. All rights reserved.