Examples of RefPtg


Examples of org.apache.poi.hssf.record.formula.RefPtg

    assertEquals(expected, nve.getNumberValue(), 0);
  }

  public void testScalarSimple() {
   
    RefEval refEval = new Ref2DEval(new RefPtg("A1"), new NumberEval(3));
    Eval[] args = {
      refEval,
      new NumberEval(2),
    };
    Eval result = invokeSumproduct(args);
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

  /**
   * Simulates call: T(A1)
   * where cell A1 has the specified innerValue
   */
  private Eval invokeTWithReference(ValueEval innerValue) {
    Eval arg = new Ref2DEval(new RefPtg((short)1, (short)1, false, false), innerValue);
    return invokeT(arg);
  }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

  /**
   * Creates a single RefEval (with value zero)
   */
  public static RefEval createRefEval(String refStr) {
    return new Ref2DEval(new RefPtg(refStr), ZERO);
  }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

        new NumberEval(25),
        new NumberEval(25),
    };
    Area2DEval arg0 = new Area2DEval(new AreaPtg("C1:C6"), values);
   
    Ref2DEval criteriaArg = new Ref2DEval(new RefPtg("A1"), new NumberEval(25));
    Eval[] args=  { arg0, criteriaArg, };
   
    double actual = NumericFunctionInvoker.invoke(new Countif(), args);
    assertEquals(4, actual, 0D);
  }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

                }
                Eval opresult = invokeOperation(operation, ops, srcRowNum, srcColNum, workbook, sheet);
                stack.push(opresult);
            }
            else if (ptg instanceof RefPtg) {
                RefPtg refPtg = (RefPtg) ptg;
                int colIx = refPtg.getColumn();
                int rowIx = refPtg.getRow();
                Row row = sheet.getRow(rowIx);
                Cell cell = (row != null) ? row.getCell(colIx) : null;
                stack.push(createRef2DEval(refPtg, cell, row, sheet, workbook));
            }
            else if (ptg instanceof Ref3DPtg) {
                Ref3DPtg refPtg = (Ref3DPtg) ptg;
                int colIx = refPtg.getColumn();
                int rowIx = refPtg.getRow();
                Sheet xsheet = workbook.getSheetAt(
                    workbook.getSheetIndexFromExternSheetIndex(refPtg.getExternSheetIndex())
                );
                Row row = xsheet.getRow(rowIx);
                Cell cell = (row != null) ? row.getCell(colIx) : null;
                stack.push(createRef3DEval(refPtg, cell, row, xsheet, workbook));
            }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

    int encodedLen = in.readUShort();
    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.RefPtg

    LittleEndianInput in = new LittleEndianInputStream(new ByteArrayInputStream(formulaRawBytes));
    byte ptgSid = in.readByte();
    switch(ptgSid) {
      case AreaPtg.sid:   return new AreaPtg(in);
      case Area3DPtg.sid: return new Area3DPtg(in);
      case RefPtg.sid:  return new RefPtg(in);
      case Ref3DPtg.sid:  return new Ref3DPtg(in);
    }
    return null;
  }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

    if (ptg instanceof Area3DPtg) {
      Area3DPtg aptg = (Area3DPtg) ptg;
      return ec.getArea3DEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn(), aptg.getExternSheetIndex());
    }
    if (ptg instanceof RefPtg) {
      RefPtg rptg = (RefPtg) ptg;
      return ec.getRefEval(rptg.getRow(), rptg.getColumn());
    }
    if (ptg instanceof AreaPtg) {
      AreaPtg aptg = (AreaPtg) ptg;
      return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.formula.RefPtg

        TextObjectRecord rec = new TextObjectRecord(is);
   
        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

    int encodedLen = in.readUShort();
    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
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.