fix for bug 9802, we write simple sum ptg, tho we can also read attr ptg. trying to write an attr ptg messes up the class change algo.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352687 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8908e20c5d
commit
1ef8d27a1e
@ -142,6 +142,7 @@ public class FormulaViewer
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
if (token instanceof ExpPtg) return;
|
||||
buf.append(name=((OperationPtg) token).toFormulaString());
|
||||
buf.append(sep);
|
||||
switch (token.getPtgClass()) {
|
||||
|
@ -446,7 +446,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg {
|
||||
functionData[0][0]=new Byte(Ptg.CLASS_VALUE);functionData[0][1]=new byte[] {Ptg.CLASS_REF};functionData[0][2]=new Integer(-1);
|
||||
functionData[2][0]=new Byte(Ptg.CLASS_VALUE);functionData[2][1]=new byte[] {Ptg.CLASS_VALUE};functionData[2][2]=new Integer(1);
|
||||
functionData[3][0]=new Byte(Ptg.CLASS_VALUE);functionData[3][1]=new byte[] {Ptg.CLASS_VALUE};functionData[3][2]=new Integer(1);
|
||||
functionData[4][0]=new Byte(Ptg.CLASS_REF);functionData[4][1]=new byte[] {Ptg.CLASS_REF};functionData[4][2]=new Integer(-1);
|
||||
functionData[4][0]=new Byte(Ptg.CLASS_VALUE);functionData[4][1]=new byte[] {Ptg.CLASS_REF};functionData[4][2]=new Integer(-1);
|
||||
functionData[5][0]=new Byte(Ptg.CLASS_VALUE);functionData[5][1]=new byte[] {Ptg.CLASS_REF};functionData[5][2]=new Integer(-1);
|
||||
functionData[6][0]=new Byte(Ptg.CLASS_VALUE);functionData[6][1]=new byte[] {Ptg.CLASS_REF};functionData[6][2]=new Integer(-1);
|
||||
functionData[7][0]=new Byte(Ptg.CLASS_VALUE);functionData[7][1]=new byte[] {Ptg.CLASS_REF};functionData[7][2]=new Integer(-1);
|
||||
|
@ -264,17 +264,17 @@ public class FormulaParser {
|
||||
|
||||
private Ptg function(String name,byte numArgs) {
|
||||
Ptg retval = null;
|
||||
|
||||
if (numArgs == 1 && name.equals("SUM")) {
|
||||
retval = new FuncVarPtg(name,numArgs);
|
||||
/** if (numArgs == 1 && name.equals("SUM")) {
|
||||
AttrPtg ptg = new AttrPtg();
|
||||
ptg.setData((short)1); //sums don't care but this is what excel does.
|
||||
ptg.setSum(true);
|
||||
retval = ptg;
|
||||
} else {
|
||||
retval = new FuncVarPtg(name,numArgs);
|
||||
}
|
||||
}*/
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/** get arguments to a function */
|
||||
|
@ -775,6 +775,12 @@ extends TestCase {
|
||||
c=r.createCell( (short) 5);
|
||||
c.setCellFormula("SIN(A2)");
|
||||
|
||||
c=r.createCell( (short) 6);
|
||||
c.setCellFormula("SUM(A2:A3)");
|
||||
|
||||
c=r.createCell( (short) 7);
|
||||
c.setCellFormula("SUM(A2,A3)");
|
||||
|
||||
r = s.createRow((short) 1);c=r.createCell( (short) 0); c.setCellValue(2.0);
|
||||
r = s.createRow((short) 2);c=r.createCell( (short) 0); c.setCellValue(3.0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user