Examples of toFormulaString()


Examples of org.apache.poi.hssf.record.formula.RefPtg.toFormulaString()

        Ptg ptg = rec.getLinkRefPtg();
        assertNotNull(ptg);
        assertEquals(RefPtg.class, ptg.getClass());
        RefPtg rptg = (RefPtg) ptg;
        assertEquals("T2", rptg.toFormulaString());

        byte [] data2 = rec.serialize();
        assertEquals(linkData.length, data2.length);
        assertTrue(Arrays.equals(linkData, data2));
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg.toFormulaString()

    Ptg[] sharedFormula = Ptg.readTokens(encodedLen, in);

    Ptg[] convertedFormula = SharedFormulaRecord.convertSharedFormulas(sharedFormula, 100, 200);

    RefPtg refPtg = (RefPtg) convertedFormula[1];
    assertEquals("$C101", refPtg.toFormulaString());
    if (refPtg.getPtgClass() == Ptg.CLASS_REF) {
      throw new AssertionFailedError("Identified bug 45123");
    }

    confirmOperandClasses(sharedFormula, convertedFormula);
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.UnionPtg.toFormulaString()

        Area3DPtg ptgC = (Area3DPtg)def.get(2);
        UnionPtg ptgD = (UnionPtg)def.get(3);
        assertEquals("", ptgA.toFormulaString(wb));
        assertEquals(refA, ptgB.toFormulaString(wb));
        assertEquals(refB, ptgC.toFormulaString(wb));
        assertEquals(",", ptgD.toFormulaString(wb));

        assertEquals(ref, nr.getAreaReference(wb));

        // Check the high level definition
        int idx = wb.getNameIndex("test");
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.UnionPtg.toFormulaString()

        Area3DPtg ptgC = (Area3DPtg)def[2];
        UnionPtg ptgD = (UnionPtg)def[3];
        assertEquals("", ptgA.toFormulaString());
        assertEquals(refA, ptgB.toFormulaString(eb));
        assertEquals(refB, ptgC.toFormulaString(eb));
        assertEquals(",", ptgD.toFormulaString());

        assertEquals(ref, HSSFFormulaParser.toFormulaString(wb, nr.getNameDefinition()));

        // Check the high level definition
        int idx = wb.getNameIndex("test");
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.UnionPtg.toFormulaString()

        Area3DPtg ptgC = (Area3DPtg)def[2];
        UnionPtg ptgD = (UnionPtg)def[3];
        assertEquals("", ptgA.toFormulaString());
        assertEquals(refA, ptgB.toFormulaString(eb));
        assertEquals(refB, ptgC.toFormulaString(eb));
        assertEquals(",", ptgD.toFormulaString());

        assertEquals(ref, HSSFFormulaParser.toFormulaString(wb, nr.getNameDefinition()));

        // Check the high level definition
        int idx = wb.getNameIndex("test");
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.Area3DPtg.toFormulaString()

        Area3DPtg ptgB = (Area3DPtg)def[1];
        Area3DPtg ptgC = (Area3DPtg)def[2];
        UnionPtg ptgD = (UnionPtg)def[3];
        assertEquals("", ptgA.toFormulaString());
        assertEquals(refA, ptgB.toFormulaString(eb));
        assertEquals(refB, ptgC.toFormulaString(eb));
        assertEquals(",", ptgD.toFormulaString());

        assertEquals(ref, HSSFFormulaParser.toFormulaString(wb, nr.getNameDefinition()));

        // Check the high level definition
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg.toFormulaString()

    AreaPtg ptg = (AreaPtg) ops[0];
    assertEquals(2, ptg.getFirstColumn());
    assertEquals(2, ptg.getLastColumn());
    assertEquals(0, ptg.getFirstRow());
    assertEquals(65535, ptg.getLastRow());
    assertEquals("C:C", ptg.toFormulaString());

    // Will show as C:C, but won't know how many
    // rows it covers as we don't have the sheet
    // to hand when turning the Ptgs into a string
    assertEquals("SUM(C:C)", cellSUM.getCellFormula());
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AttrPtg.toFormulaString()

                    // similar to tAttrSpace - RPN is violated
                    continue;
                }
                if (attrPtg.isSum()) {
                    String[] operands = getOperands(stack, attrPtg.getNumberOfOperands());
                    stack.push(attrPtg.toFormulaString(operands));
                    continue;
                }
                throw new RuntimeException("Unexpected tAttr: " + attrPtg.toString());
            }
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.MemFuncPtg.toFormulaString()

        MemFuncPtg ptgA = (MemFuncPtg)def[0];
        Area3DPtg ptgB = (Area3DPtg)def[1];
        Area3DPtg ptgC = (Area3DPtg)def[2];
        UnionPtg ptgD = (UnionPtg)def[3];
        assertEquals("", ptgA.toFormulaString());
        assertEquals(refA, ptgB.toFormulaString(eb));
        assertEquals(refB, ptgC.toFormulaString(eb));
        assertEquals(",", ptgD.toFormulaString());

        assertEquals(ref, HSSFFormulaParser.toFormulaString(wb, nr.getNameDefinition()));
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.NamePtg.toFormulaString()

    Ptg[] ptg = HSSFFormulaParser.parse("myFunc()", w);
    // myFunc() actually takes 1 parameter.  Don't know if POI will ever be able to detect this problem

    // the name gets encoded as the first arg
    NamePtg tname = (NamePtg) ptg[0];
    assertEquals("myFunc", tname.toFormulaString(book));

    AbstractFunctionPtg tfunc = (AbstractFunctionPtg) ptg[1];
    assertTrue(tfunc.isExternalFunction());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.