Package org.apache.poi.hssf.record.formula

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


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

    assertEquals(4, actual, 0D);
  }
 

  private static AreaEval createAreaEval(String areaRefStr, ValueEval[] values) {
    return new Area2DEval(new AreaPtg(areaRefStr), values);
  }
View Full Code Here

                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

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

    // Actually stored as C1 to C65536
    // (last row is -1 === 65535)
    AreaPtg ptg = (AreaPtg) ops.get(0);
    assertEquals(2, ptg.getFirstColumn());
    assertEquals(2, ptg.getLastColumn());
    assertEquals(0, ptg.getFirstRow());
    assertEquals(65535, ptg.getLastRow());
    assertEquals("C:C", ptg.toFormulaString(wb));

    // 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

   
    // text (first) arg type is number, other args are strings with fractional digits
    confirmMid(new NumberEval(123456), new StringEval("3.1"), new StringEval("2.9"), "34");
   
    // startPos is 1x1 area ref, numChars is cell ref
    AreaEval aeStart = new Area2DEval(new AreaPtg("A1:A1"), new ValueEval[] { new NumberEval(2), } );
    RefEval reNumChars = new Ref2DEval(new RefPtg("B1"), new NumberEval(3));
    confirmMid(new StringEval("galactic"), aeStart, reNumChars, "ala");

    confirmMid(new StringEval("galactic"), new NumberEval(3.1), BlankEval.INSTANCE, "");
View Full Code Here

  public void testColumnOperand() {

    short firstRow = (short)8;
    short lastRow = (short)12;
    short colNum = (short)5;
    AreaPtg areaPtg = new AreaPtg(firstRow, lastRow, colNum, colNum, false, false, false, false);
    ValueEval[] values = {
        new NumberEval(27)
        new NumberEval(29)
        new NumberEval(35)// value in row 10
        new NumberEval(37)
View Full Code Here

    ValueEval[] values = new ValueEval[nValues];
    for (int i = 0; i < nValues; i++) {
      values[i] = ZERO;
    }
   
    return new Area2DEval(new AreaPtg(areaRefStr), values);
  }
View Full Code Here

        new NumberEval(21),
        new NumberEval(25),
        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);
View Full Code Here

    assertEquals(4, actual, 0D);
  }
 

  private static AreaEval createAreaEval(String areaRefStr, ValueEval[] values) {
    return new Area2DEval(new AreaPtg(areaRefStr), values);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.AreaPtg

Copyright © 2018 www.massapicom. 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.