Examples of FormulaRecord


Examples of org.apache.poi.hssf.record.FormulaRecord

                (( BlankRecord ) record).setRow(row);
                (( BlankRecord ) record).setXFIndex(( short ) 0);
                break;

            case CELL_TYPE_FORMULA :
                record = new FormulaRecord();
                (( FormulaRecord ) record).setColumn(col);
                (( FormulaRecord ) record).setRow(row);
                (( FormulaRecord ) record).setXFIndex(( short ) 0);
            case CELL_TYPE_BOOLEAN :
                record = new BoolErrRecord();
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

        }
        switch (cellType)
        {

            case CELL_TYPE_FORMULA :
                FormulaRecord frec = null;

                if (cellType != this.cellType)
                {
                    frec = new FormulaRecord();
                }
                else
                {
                    frec = ( FormulaRecord ) record;
                }
                frec.setColumn(getCellNum());
                if (setValue)
                {
                    frec.setValue(getNumericCellValue());
                }
                frec.setXFIndex(( short ) cellStyle.getIndex());
                frec.setRow(row);
                record = frec;
                break;

            case CELL_TYPE_NUMERIC :
                NumberRecord nrec = null;
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

        if (formula==null) {
            setCellType(CELL_TYPE_BLANK,false);
        } else {
           
            setCellType(CELL_TYPE_FORMULA,false);
            FormulaRecord rec = (FormulaRecord) record;
            rec.setOptions(( short ) 2);
            rec.setValue(0);
            rec.setXFIndex(( short ) 0x0f);
            FormulaParser fp = new FormulaParser(formula+";");
            fp.parse();
            Ptg[] ptg  = fp.getRPNPtg();
            int   size = 0;
            //System.out.println("got Ptgs " + ptg.length);
            for (int k = 0; k < ptg.length; k++) {
                size += ptg[ k ].getSize();
                rec.pushExpressionToken(ptg[ k ]);
            }
            rec.setExpressionLength(( short ) size);
            //return rec;
           
        }
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

      HSSFCell cell = (HSSFCell)it.next();
      if(cell.getCellType() != HSSFCell.CELL_TYPE_FORMULA) {
          continue;
      }
      FormulaRecordAggregate record = (FormulaRecordAggregate) cell.getCellValueRecord();
      FormulaRecord r = record.getFormulaRecord();
      Ptg[] ptgs = r.getParsedExpression();
     
      String cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex(), false, false).formatAsString();
      if(false && cellRef.equals("BP24")) { // TODO - replace System.out.println()s with asserts
        System.out.print(cellRef);
        System.out.println(" - has " + ptgs.length + " ptgs:");
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

* @author avik
*/
public final class TestFormulaRecordAggregate extends TestCase {

  public void testBasic() throws Exception {
    FormulaRecord f = new FormulaRecord();
    f.setCachedResultTypeString();
    StringRecord s = new StringRecord();
    s.setString("abc");
    FormulaRecordAggregate fagg = new FormulaRecordAggregate(f, s, SharedValueManager.EMPTY);
    assertEquals("abc", fagg.getStringValue());
  }
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

   * Bug 46213 attachment 22874 has such an extra {@link StringRecord} at stream offset 0x5765.
   * This file seems to open in Excel (2007) with no trouble.  When it is re-saved, Excel omits
   * the extra record.  POI should do the same.
   */
  public void testExtraStringRecord_bug46213() {
    FormulaRecord fr = new FormulaRecord();
    fr.setValue(2.0);
    StringRecord sr = new StringRecord();
    sr.setString("NA");
    SharedValueManager svm = SharedValueManager.EMPTY;
    FormulaRecordAggregate fra;
   
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

    records.add(Sheet.createBOF());
    records.add(new DimensionsRecord());
    records.add(new RowRecord(0));
    records.add(new RowRecord(1));
    FormulaRecord formulaRecord = new FormulaRecord();
    formulaRecord.setCachedResultTypeString();
    records.add(formulaRecord);
    records.add(new StringRecord());
    records.add(new RowRecord(2));
    records.add(createWindow2Record());
    records.add(EOFRecord.instance);
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

        }
        int sheetIndex = _book.getSheetIndex(_sheet);
        Ptg[] ptgs = HSSFFormulaParser.parse(formula, _book, FormulaType.CELL, sheetIndex);
        setCellType(CELL_TYPE_FORMULA, false, row, col, styleIndex);
        FormulaRecordAggregate agg = (FormulaRecordAggregate) _record;
        FormulaRecord frec = agg.getFormulaRecord();
        frec.setOptions((short) 2);
        frec.setValue(0);

        //only set to default if there is no extended format index already set
        if (agg.getXFIndex() == (short)0) {
            agg.setXFIndex((short) 0x0f);
        }
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

            default:
                throw typeMismatch(CELL_TYPE_NUMERIC, _cellType, false);
            case CELL_TYPE_FORMULA:
                break;
        }
        FormulaRecord fr = ((FormulaRecordAggregate)_record).getFormulaRecord();
        checkFormulaCachedValueType(CELL_TYPE_NUMERIC, fr);
        return fr.getValue();
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.FormulaRecord

            case CELL_TYPE_NUMERIC:
                return ((NumberRecord)_record).getValue() != 0;

            case CELL_TYPE_FORMULA:
                // use cached formula result if it's the right type:
                FormulaRecord fr = ((FormulaRecordAggregate)_record).getFormulaRecord();
                checkFormulaCachedValueType(CELL_TYPE_BOOLEAN, fr);
                return fr.getCachedBooleanValue();
            // Other cases convert to false
            // These choices are not well justified.
            case CELL_TYPE_ERROR:
            case CELL_TYPE_BLANK:
                return false;
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.