Package org.apache.poi.ss.formula

Examples of org.apache.poi.ss.formula.EvaluationCell


   *
   * @param cell may be <code>null</code> signifying that the cell is not present (or blank)
   * @return <code>null</code> if the supplied cell is <code>null</code> or blank
   */
  public ValueEval evaluate(String sheetName, int rowIndex, int columnIndex) {
    EvaluationCell cell = _sewb.getEvaluationCell(sheetName, rowIndex, columnIndex);

    switch (cell.getCellType()) {
      case HSSFCell.CELL_TYPE_BOOLEAN:
        return BoolEval.valueOf(cell.getBooleanCellValue());
      case HSSFCell.CELL_TYPE_ERROR:
        return ErrorEval.valueOf(cell.getErrorCellValue());
      case HSSFCell.CELL_TYPE_FORMULA:
        return _evaluator.evaluate(cell);
      case HSSFCell.CELL_TYPE_NUMERIC:
        return new NumberEval(cell.getNumericCellValue());
      case HSSFCell.CELL_TYPE_STRING:
        return new StringEval(cell.getStringCellValue());
      case HSSFCell.CELL_TYPE_BLANK:
        return null;
    }
    throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");
  }
View Full Code Here


   *
   * @param cell may be <code>null</code> signifying that the cell is not present (or blank)
   * @return <code>null</code> if the supplied cell is <code>null</code> or blank
   */
  public ValueEval evaluate(String sheetName, int rowIndex, int columnIndex) {
    EvaluationCell cell = _sewb.getEvaluationCell(sheetName, rowIndex, columnIndex);

    switch (cell.getCellType()) {
      case HSSFCell.CELL_TYPE_BOOLEAN:
        return BoolEval.valueOf(cell.getBooleanCellValue());
      case HSSFCell.CELL_TYPE_ERROR:
        return ErrorEval.valueOf(cell.getErrorCellValue());
      case HSSFCell.CELL_TYPE_FORMULA:
        return _evaluator.evaluate(cell);
      case HSSFCell.CELL_TYPE_NUMERIC:
        return new NumberEval(cell.getNumericCellValue());
      case HSSFCell.CELL_TYPE_STRING:
        return new StringEval(cell.getStringCellValue());
      case HSSFCell.CELL_TYPE_BLANK:
        return null;
    }
    throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");
  }
View Full Code Here

   *
   * @param cell may be <code>null</code> signifying that the cell is not present (or blank)
   * @return <code>null</code> if the supplied cell is <code>null</code> or blank
   */
  public ValueEval evaluate(String sheetName, int rowIndex, int columnIndex) {
    EvaluationCell cell = _sewb.getEvaluationCell(sheetName, rowIndex, columnIndex);

    switch (cell.getCellType()) {
      case HSSFCell.CELL_TYPE_BOOLEAN:
        return BoolEval.valueOf(cell.getBooleanCellValue());
      case HSSFCell.CELL_TYPE_ERROR:
        return ErrorEval.valueOf(cell.getErrorCellValue());
      case HSSFCell.CELL_TYPE_FORMULA:
        return _evaluator.evaluate(cell);
      case HSSFCell.CELL_TYPE_NUMERIC:
        return new NumberEval(cell.getNumericCellValue());
      case HSSFCell.CELL_TYPE_STRING:
        return new StringEval(cell.getStringCellValue());
      case HSSFCell.CELL_TYPE_BLANK:
        return null;
    }
    throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");
  }
View Full Code Here

  public ForkedEvaluationCell getOrCreateUpdatableCell(int rowIndex, int columnIndex) {
    RowColKey key = new RowColKey(rowIndex, columnIndex);

    ForkedEvaluationCell result = _sharedCellsByRowCol.get(key);
    if (result == null) {
      EvaluationCell mcell = _masterSheet.getCell(rowIndex, columnIndex);
      result = new ForkedEvaluationCell(this, mcell);
      _sharedCellsByRowCol.put(key, result);
    }
    return result;
  }
View Full Code Here

     * @param rowIndex zero based
     * @param columnIndex zero based
   * @return <code>null</code> if the supplied cell is <code>null</code> or blank
   */
  public ValueEval evaluate(String sheetName, int rowIndex, int columnIndex) {
    EvaluationCell cell = _sewb.getEvaluationCell(sheetName, rowIndex, columnIndex);

    switch (cell.getCellType()) {
      case HSSFCell.CELL_TYPE_BOOLEAN:
        return BoolEval.valueOf(cell.getBooleanCellValue());
      case HSSFCell.CELL_TYPE_ERROR:
        return ErrorEval.valueOf(cell.getErrorCellValue());
      case HSSFCell.CELL_TYPE_FORMULA:
        return _evaluator.evaluate(cell);
      case HSSFCell.CELL_TYPE_NUMERIC:
        return new NumberEval(cell.getNumericCellValue());
      case HSSFCell.CELL_TYPE_STRING:
        return new StringEval(cell.getStringCellValue());
      case HSSFCell.CELL_TYPE_BLANK:
        return null;
    }
    throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");
  }
View Full Code Here

  public ForkedEvaluationCell getOrCreateUpdatableCell(int rowIndex, int columnIndex) {
    RowColKey key = new RowColKey(rowIndex, columnIndex);

    ForkedEvaluationCell result = _sharedCellsByRowCol.get(key);
    if (result == null) {
      EvaluationCell mcell = _masterSheet.getCell(rowIndex, columnIndex);
      if (mcell == null) {
        CellReference cr = new CellReference(rowIndex, columnIndex);
        throw new UnsupportedOperationException("Underlying cell '"
            + cr.formatAsString() + "' is missing in master sheet.");
      }
View Full Code Here

     * @param rowIndex zero based
     * @param columnIndex zero based
   * @return <code>null</code> if the supplied cell is <code>null</code> or blank
   */
  public ValueEval evaluate(String sheetName, int rowIndex, int columnIndex) {
    EvaluationCell cell = _sewb.getEvaluationCell(sheetName, rowIndex, columnIndex);

    switch (cell.getCellType()) {
      case Cell.CELL_TYPE_BOOLEAN:
        return BoolEval.valueOf(cell.getBooleanCellValue());
      case Cell.CELL_TYPE_ERROR:
        return ErrorEval.valueOf(cell.getErrorCellValue());
      case Cell.CELL_TYPE_FORMULA:
        return _evaluator.evaluate(cell);
      case Cell.CELL_TYPE_NUMERIC:
        return new NumberEval(cell.getNumericCellValue());
      case Cell.CELL_TYPE_STRING:
        return new StringEval(cell.getStringCellValue());
      case Cell.CELL_TYPE_BLANK:
        return null;
    }
    throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.EvaluationCell

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.