Examples of RefPtg


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();
                HSSFRow row = sheet.getRow(rowIx);
                HSSFCell 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();
                Workbook wb = workbook.getWorkbook();
                HSSFSheet xsheet = workbook.getSheetAt(wb.getSheetIndexFromExternSheetIndex(refPtg.getExternSheetIndex()));
                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) {
View Full Code Here

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

                    // Look for references, and update if needed
                    Ptg[] ptgs = fp.getRPNPtg();
                    boolean changed = false;
                    for(int i=0; i<ptgs.length; i++) {
                        if(ptgs[i] instanceof RefPtg) {
                            RefPtg rptg = (RefPtg)ptgs[i];
                            if(startRow <= rptg.getRowAsInt() &&
                                    rptg.getRowAsInt() <= endRow) {
                                // References a row that moved
                                rptg.setRow(rptg.getRowAsInt() + n);
                                changed = true;
                            }
                        }
                    }
                    // If any references were changed, then
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

      throw new RuntimeException(e);
    } catch (NoSuchFieldException e) {
      throw new RuntimeException(e);
    }
    Ptg[] ptgs = {
        new RefPtg("C1"),
        new RefPtg("C1"),
        new IntPtg(0),
        new RefPtg("B1"),
        FuncVarPtg.create("OFFSET", (byte)3),
        RangePtg.instance,
        AttrPtg.SUM,
      };
    fr.setParsedExpression(ptgs);
View Full Code Here

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

   */
  public static RefEval createRefEval(String refStr) {
    return createRefEval(refStr, NumberEval.ZERO);
  }
  public static RefEval createRefEval(String refStr, ValueEval value) {
    return new MockRefEval(new RefPtg(refStr), value);
  }
View Full Code Here

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

      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.RefPtg

      throw new RuntimeException(e);
    } catch (NoSuchFieldException e) {
      throw new RuntimeException(e);
    }
    Ptg[] ptgs = {
        new RefPtg("C1"),
        new RefPtg("C1"),
        new IntPtg(0),
        new RefPtg("B1"),
        new FuncVarPtg("OFFSET", (byte)3),
        RangePtg.instance,
        AttrPtg.SUM,
      };
    fr.setParsedExpression(ptgs);
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

        if (!(ptgB instanceof RefPtg)) {
            // only when second ref is simple 2-D ref can the range
            // expression be converted to an area ref
            return null;
        }
        RefPtg refB = (RefPtg) ptgB;

        if (ptgA instanceof RefPtg) {
            RefPtg refA = (RefPtg) ptgA;
            return new AreaPtg(refA.getRow(), refB.getRow(), refA.getColumn(), refB.getColumn(),
                    refA.isRowRelative(), refB.isRowRelative(), refA.isColRelative(), refB.isColRelative());
        }
        if (ptgA instanceof Ref3DPtg) {
            Ref3DPtg refA = (Ref3DPtg) ptgA;
            return new Area3DPtg(refA.getRow(), refB.getRow(), refA.getColumn(), refB.getColumn(),
                    refA.isRowRelative(), refB.isRowRelative(), refA.isColRelative(), refB.isColRelative(),
                    refA.getExternSheetIndex());
        }
        // Note - other operand types (like AreaPtg) which probably can't evaluate
        // do not cause validation errors at parse time
        return null;
    }
View Full Code Here

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

        // This can be either a cell ref or a named range


        int nameType = CellReference.classifyCellReference(name);
        if (nameType == NameType.CELL) {
            return new RefPtg(name);
        }
        if (look == ':') {
            if (nameType == NameType.COLUMN) {
                GetChar();
                String secondIden = parseUnquotedIdentifier();
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.