Package org.apache.poi.hssf.record

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


   * Processes a single cell value record
   * @param sfh used to resolve any shared-formulas/arrays/tables for the current sheet
   */
  public void construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh) {
    if (rec instanceof FormulaRecord) {
      FormulaRecord formulaRec = (FormulaRecord)rec;
      // read optional cached text value
      StringRecord cachedText;
      Class<? extends Record> nextClass = rs.peekNextClass();
      if (nextClass == StringRecord.class) {
        cachedText = (StringRecord) rs.getNext();
View Full Code Here


    records.add(InternalSheet.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

        case MergeCellsRecord.sid:    dest = mergeCellRecords; break;
        case SharedFormulaRecord.sid: dest = shFrmRecords;
          if (!(prevRec instanceof FormulaRecord)) {
            throw new RuntimeException("Shared formula record should follow a FormulaRecord");
          }
          FormulaRecord fr = (FormulaRecord)prevRec;
          firstCellRefs.add(new CellReference(fr.getRow(), fr.getColumn()));
          break;
        case ArrayRecord.sid:         dest = arrayRecords;     break;
        case TableRecord.sid:         dest = tableRecords;     break;
        default:                      dest = plainRecords;
      }
View Full Code Here

      ((FormulaRecordAggregate)cvRec).notifyFormulaChanging();
    }
    _valuesAgg.removeCell(cvRec);
  }
  public FormulaRecordAggregate createFormula(int row, int col) {
    FormulaRecord fr = new FormulaRecord();
    fr.setRow(row);
    fr.setColumn((short) col);
    return new FormulaRecordAggregate(fr, null, _sharedValueManager);
  }
View Full Code Here

        }
        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

            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

            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

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

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

    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

TOP

Related Classes of org.apache.poi.hssf.record.FormulaRecord

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.