Examples of AreaPtg


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

                HSSFRow row = xsheet.getRow(rownum);
                HSSFCell cell = (row != null) ? row.getCell(colnum) : null;
                pushRef3DEval(ptg, stack, cell, row, xsheet, workbook);
            }
            else if (ptgs[i] instanceof AreaPtg) {
                AreaPtg ap = (AreaPtg) ptgs[i];
                short row0 = ap.getFirstRow();
                short col0 = ap.getFirstColumn();
                short row1 = ap.getLastRow();
                short col1 = ap.getLastColumn();
                ValueEval[] values = new ValueEval[(row1 - row0 + 1) * (col1 - col0 + 1)];
                for (short x = row0; sheet != null && x < row1 + 1; x++) {
                    HSSFRow row = sheet.getRow(x);
                    for (short y = col0; row != null && y < col1 + 1; y++) {
                        values[(x - row0) * (col1 - col0 + 1) + (y - col0)] =
View Full Code Here

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

                HSSFRow row = xsheet.getRow(rowIx);
                HSSFCell cell = (row != null) ? row.getCell(colIx) : null;
                stack.push(createRef3DEval(refPtg, cell, row, xsheet, workbook));
            }
            else if (ptg instanceof AreaPtg) {
                AreaPtg ap = (AreaPtg) ptg;
                AreaEval ae = evaluateAreaPtg(sheet, workbook, ap);
                stack.push(ae);
            }
            else if (ptg instanceof Area3DPtg) {
                Area3DPtg a3dp = (Area3DPtg) ptg;
View Full Code Here

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

    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());
    }

    if (ptg instanceof UnknownPtg) {
      // POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
      // This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
View Full Code Here

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

        assertTrue(sr instanceof LbsDataSubRecord);
        LbsDataSubRecord lbs = (LbsDataSubRecord)sr;
        assertEquals(4, lbs.getNumberOfItems());

        assertTrue(lbs.getFormula() instanceof AreaPtg);
        AreaPtg ptg = (AreaPtg)lbs.getFormula();
        CellRangeAddress range = new CellRangeAddress(
                ptg.getFirstRow(), ptg.getLastRow(), ptg.getFirstColumn(), ptg.getLastColumn());
        assertEquals("H10:H13", range.formatAsString());

        // check that it re-serializes to the same data
        byte[] ser = record.serialize();
        TestcaseRecordInputStream.confirmRecordEncoding(ObjRecord.sid, data, ser);
View Full Code Here

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

  /**
   * Creates a dummy AreaEval
   * @param values empty (<code>null</code>) entries in this array will be converted to NumberEval.ZERO
   */
  public static AreaEval createAreaEval(String areaRefStr, ValueEval[] values) {
    AreaPtg areaPtg = new AreaPtg(areaRefStr);
    return createAreaEval(areaPtg, values);
  }
View Full Code Here

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

    }
    private static Ptg readRefPtg(byte[] formulaRawBytes) {
      LittleEndianInput in = new LittleEndianByteArrayInputStream(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.AreaPtg

    assertEquals(AreaPtg.class, ops[0].getClass());
    assertEquals(FuncVarPtg.class, ops[1].getClass());

    // Actually stored as C1 to C65536
    // (last row is -1 === 65535)
    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.hssf.record.formula.AreaPtg

                HSSFRow row = xsheet.getRow(rowIx);
                HSSFCell cell = (row != null) ? row.getCell(colIx) : null;
                stack.push(createRef3DEval(refPtg, cell, row, xsheet, workbook));
            }
            else if (ptg instanceof AreaPtg) {
                AreaPtg ap = (AreaPtg) ptg;
                AreaEval ae = evaluateAreaPtg(sheet, workbook, ap);
                stack.push(ae);
            }
            else if (ptg instanceof Area3DPtg) {
                Area3DPtg a3dp = (Area3DPtg) ptg;
View Full Code Here

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

          false, false, false, false,
          baseRef.getExternalSheetIndex());
      return HSSFFormulaEvaluator.evaluateArea3dPtg(workbook, a3dp);
    }
   
    AreaPtg ap = new AreaPtg(rows.getFirstIndex(), rows.getLastIndex(),
        cols.getFirstIndex(), cols.getLastIndex(),
        false, false, false, false);
    return HSSFFormulaEvaluator.evaluateAreaPtg(sheet, workbook, ap);
  }
View Full Code Here

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

      int rowNum, int colNum, double expectedResult) {
    ValueEval[] values = new ValueEval[dValues.length];
    for (int i = 0; i < values.length; i++) {
      values[i] = new NumberEval(dValues[i]);
    }
    Area2DEval arg0 = new Area2DEval(new AreaPtg(areaRefString), values);
   
    Eval[] args;
    if (colNum > 0) {
      args = new Eval[] { arg0, new NumberEval(rowNum), new NumberEval(colNum), };
    } else {
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.