Now provides string formula, reads simple formulas, mmmm formulas
PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
223e626598
commit
299fcceb90
@ -157,7 +157,7 @@ public class FormulaRecord
|
||||
int offset)
|
||||
{
|
||||
Stack stack = new Stack();
|
||||
/*int pos = 22 + offset;
|
||||
int pos = 22 + offset;
|
||||
|
||||
while (pos < size)
|
||||
{
|
||||
@ -165,7 +165,7 @@ public class FormulaRecord
|
||||
|
||||
pos += ptg.getSize();
|
||||
stack.push(ptg);
|
||||
}*/
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -390,6 +390,18 @@ end;
|
||||
return (Ptg[]) tokens.toArray(retval);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convience method which takes in a list then passes it to the other toFormulaString
|
||||
* signature
|
||||
*/
|
||||
public static String toFormulaString(List lptgs) {
|
||||
String retval = null;
|
||||
Ptg[] ptgs = new Ptg[lptgs.size()];
|
||||
ptgs = (Ptg[])lptgs.toArray(ptgs);
|
||||
retval = toFormulaString(ptgs);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/** Static method to convert an array of Ptgs in RPN order
|
||||
* to a human readable string format in infix mode
|
||||
|
@ -712,6 +712,15 @@ public class HSSFCell
|
||||
}
|
||||
}
|
||||
|
||||
public String getCellFormula() {
|
||||
String retval=null;
|
||||
|
||||
retval =
|
||||
FormulaParser.toFormulaString(((FormulaRecord)record).getParsedExpression());
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the value of the cell as a number. For strings we throw an exception.
|
||||
|
Loading…
Reference in New Issue
Block a user