Java Code Examples for org.apache.poi.ss.usermodel.Cell#CELL_TYPE_BLANK

The following examples show how to use org.apache.poi.ss.usermodel.Cell#CELL_TYPE_BLANK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Excel2007ResultSet.java    From rapidminer-studio with GNU Affero General Public License v3.0 11 votes vote down vote up
@Override
public ValueType getNativeValueType(int columnIndex) throws ParseException {
	Cell cell = getCurrentCell(columnIndex);
	final int type = cell.getCellType();
	if (type == Cell.CELL_TYPE_BLANK) {
		return ValueType.EMPTY;
	} else if (type == Cell.CELL_TYPE_STRING) {
		return ValueType.STRING;
	} else if (type == Cell.CELL_TYPE_NUMERIC) {
		if (DateUtil.isCellDateFormatted(cell)) {
			return ValueType.DATE;
		} else {
			return ValueType.NUMBER;
		}
	} else if (type == Cell.CELL_TYPE_FORMULA) {
		if (cell.getCachedFormulaResultType() == Cell.CELL_TYPE_NUMERIC) {
			return ValueType.NUMBER;
		} else {
			return ValueType.STRING;
		}
	} else {
		return ValueType.STRING;
	}
}
 
Example 2
Source File: DataImporterController.java    From curly with Apache License 2.0 6 votes vote down vote up
private String getStringValueFromCell(Cell cell) {
    if (cell == null) {
        return null;
    }
    int cellType = cell.getCellType();
    if (cellType == Cell.CELL_TYPE_FORMULA) {
        cellType = cell.getCachedFormulaResultType();
    }
    switch (cellType) {
        case Cell.CELL_TYPE_BOOLEAN:
            return Boolean.toString(cell.getBooleanCellValue());
        case Cell.CELL_TYPE_BLANK:
            return null;
        case Cell.CELL_TYPE_NUMERIC:
            double num = cell.getNumericCellValue();
            if (num == Math.floor(num)) {
                return Integer.toString((int) num);
            } else {
                return Double.toString(cell.getNumericCellValue());
            }
        case Cell.CELL_TYPE_STRING:
            return cell.getStringCellValue();
        default:
            return "???";
    }
}
 
Example 3
Source File: CsvColumnKeyRowKeySourceGetter.java    From SimpleFlatMapper with MIT License 6 votes vote down vote up
@Override
public Object getValue(CsvColumnKey key, Row source) {
    final Cell cell = source.getCell(key.getIndex());
    if (cell != null) {
        switch (cell.getCellType()) {
            case Cell.CELL_TYPE_BLANK:
                return null;
            case Cell.CELL_TYPE_BOOLEAN:
                return cell.getBooleanCellValue();
            case Cell.CELL_TYPE_NUMERIC:
                return cell.getNumericCellValue();
            default:
                return cell.getStringCellValue();
        }
    }
    return null;
}
 
Example 4
Source File: ExcelUtils.java    From onetwo with Apache License 2.0 6 votes vote down vote up
public static Object getCellValue(Cell cell){
		if(cell==null)
			return null;
		int type = cell.getCellType();
		Object value = null;
		if(Cell.CELL_TYPE_STRING==type){
//			value = StringUtils.cleanInvisibleUnicode(cell.getStringCellValue().trim());
			value = cell.getStringCellValue().trim();
		}else if(Cell.CELL_TYPE_NUMERIC==type){
			value = cell.getNumericCellValue();
		}else if(Cell.CELL_TYPE_FORMULA==type){
			value = cell.getCellFormula();
		}else if(Cell.CELL_TYPE_BOOLEAN==type){
			value = cell.getBooleanCellValue();
		}else if(Cell.CELL_TYPE_BLANK==type){
			value = "";
		}
		return value;
	}
 
Example 5
Source File: WorkbookReaderFactory.java    From onetwo with Apache License 2.0 6 votes vote down vote up
@Override
public String doConvert(Cell cell) {
	int type = cell.getCellType();
	String value = null;
	if(Cell.CELL_TYPE_STRING==type){
		value = getStringValue(cell);
	}else if(Cell.CELL_TYPE_NUMERIC==type){
		Double dvalue = cell.getNumericCellValue();
		if(dvalue!=null){
			value = String.valueOf(dvalue.longValue());
		}
	}else if(Cell.CELL_TYPE_FORMULA==type){
		CellValue cv = ExcelUtils.getFormulaCellValue(cell);
		value = cv==null?defaultValue:cv.getStringValue();
	}else if(Cell.CELL_TYPE_BOOLEAN==type){
		boolean bvalue = cell.getBooleanCellValue();
		value = String.valueOf(bvalue);
	}else if(Cell.CELL_TYPE_BLANK==type){
		value = "";
	}
	return value;
}
 
Example 6
Source File: ExcelUtils.java    From components with Apache License 2.0 5 votes vote down vote up
public static boolean isEmptyRow4Stream(Row row) {
  if (row == null) {
      return true;
  }
  
  for (Cell cell : row) {
      if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK  && StringUtils.isNotBlank(cell.toString())) {
          return false;
      }
  }
  return true;
}
 
Example 7
Source File: ExcelDataWriter.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void commitCell(DataCell cell) {
    int cellType = cell.getCellType();
    switch(cellType) {
        case Cell.CELL_TYPE_NUMERIC:

        case Cell.CELL_TYPE_BLANK:
        case Cell.CELL_TYPE_FORMULA:
        case Cell.CELL_TYPE_STRING:

        case Cell.CELL_TYPE_BOOLEAN:

        default:

    }
}
 
Example 8
Source File: DynamicSheetMapper.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
private SheetMapper<T> getPoiMapper(int startRow, Sheet sheet) {
    Row row = sheet.getRow(startRow);

    List<CsvColumnKey> keys = new ArrayList<CsvColumnKey>(row.getLastCellNum() - row.getFirstCellNum());
    for(short i = row.getFirstCellNum(); i <= row.getLastCellNum(); i++) {
        Cell cell = row.getCell(i);
        if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) {
            keys.add(new CsvColumnKey(cell.getStringCellValue(), i));
        }
    }

    return getPoiMapper(new MapperKey<CsvColumnKey>(keys.toArray(new CsvColumnKey[0])));


}
 
Example 9
Source File: Excel2XMLTransformer.java    From equalize-xpi-modules with MIT License 5 votes vote down vote up
private String retrieveCellContent(Cell cell, Workbook wb, boolean evaluateFormulas, String formatting) {
	FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
	DataFormatter formatter = new DataFormatter(true);
	String cellContent = null;
	int cellType = cell.getCellType();
	switch(cellType) {
	case Cell.CELL_TYPE_BLANK:
		break;
	case Cell.CELL_TYPE_FORMULA:
		if (evaluateFormulas) {
			cellContent = formatter.formatCellValue(cell, evaluator);
		} else {
			// Display the formula instead
			cellContent = cell.getCellFormula();
		}
		break;
	default:
		if(formatting.equalsIgnoreCase("excel")) {
			cellContent = formatter.formatCellValue(cell);
		} else if(formatting.equalsIgnoreCase("raw")) {
			// Display the raw cell contents
			switch (cellType) {
			case Cell.CELL_TYPE_NUMERIC:
				cellContent = Double.toString(cell.getNumericCellValue());
				break;
			case Cell.CELL_TYPE_STRING:
				cellContent = cell.getStringCellValue();
				break;
			case Cell.CELL_TYPE_BOOLEAN:
				cellContent = Boolean.toString(cell.getBooleanCellValue());
				break;	
			}
		}
		break;
	}
	return cellContent;
}
 
Example 10
Source File: ExcelTempletService.java    From jeewx with Apache License 2.0 5 votes vote down vote up
/**
  * 得到某个格子的值 已经对过时方法进行更新
  * 
  * @param cell
  *            格子对象
  * @return 格子的值
  */
public static String getCellValueString(Cell cell) {
  if (cell == null) {
   return null;
  }
  // 时间对象 特殊处理
  int dataFormat = cell.getCellStyle().getDataFormat();
  
  if (dataFormat == 14 || dataFormat == 178 || dataFormat == 180 || dataFormat == 181
    || dataFormat == 182) {
	  	return getDateValue(cell);
  } 
  String value = null;
  switch (cell.getCellType()) {
	   case Cell.CELL_TYPE_NUMERIC :
	    value = new DecimalFormat("0.##########").format(cell.getNumericCellValue());
	    break;
	   case Cell.CELL_TYPE_STRING :
	    // value = cell.getStringCellValue();
	    value = cell.getRichStringCellValue().toString();
	    break;
	   case Cell.CELL_TYPE_FORMULA :
	    value = String.valueOf(cell.getCellFormula());
	    break;
	   case Cell.CELL_TYPE_BLANK :
	    // value = String.valueOf(cell.getStringCellValue());
	    value = String.valueOf(cell.getRichStringCellValue().toString());
	    break;
	   case Cell.CELL_TYPE_BOOLEAN :
	    value = String.valueOf(cell.getBooleanCellValue());
	    break;
	   case Cell.CELL_TYPE_ERROR :
	    value = String.valueOf(cell.getErrorCellValue());
	    break;
  }
  return value;
 }
 
Example 11
Source File: Excel2007ResultSet.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public boolean isMissing(int columnIndex) {
	Cell cell = getCurrentCell(columnIndex);
	try {
		return cell == null || cell.getCellType() == Cell.CELL_TYPE_BLANK
				|| cell.getCellType() == Cell.CELL_TYPE_ERROR || "".equals(cell.getStringCellValue().trim());
	} catch (IllegalStateException e) {
		return false;
	}
}
 
Example 12
Source File: PoiDoubleGetter.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
@Override
public Double get(Row target) throws Exception {
    final Cell cell = target.getCell(index);
    if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) {
        return cell.getNumericCellValue();
    } else {
        return null;
    }
}
 
Example 13
Source File: FileDatasetXlsDataReader.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean checkIfRowIsEmpty(Row row) {
	if (row == null) {
		return true;
	}
	if (row.getLastCellNum() <= 0) {
		return true;
	}
	for (int cellNum = row.getFirstCellNum(); cellNum < row.getLastCellNum(); cellNum++) {
		Cell cell = row.getCell(cellNum);
		if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK && org.apache.commons.lang.StringUtils.isNotBlank(cell.toString())) {
			return false;
		}
	}
	return true;
}
 
Example 14
Source File: FileUtils.java    From atlas with Apache License 2.0 5 votes vote down vote up
private static boolean isRowEmpty(Row row) {
    for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) {
        Cell cell = row.getCell(c);

        if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) {
            return false;
        }
    }

    return true;
}
 
Example 15
Source File: PoiCell.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public KCellType getType() {
  int type = cell.getCellType();
  if ( type == Cell.CELL_TYPE_BOOLEAN ) {
    return KCellType.BOOLEAN;
  } else if ( type == Cell.CELL_TYPE_NUMERIC ) {
    if ( HSSFDateUtil.isCellDateFormatted( cell ) ) {
      return KCellType.DATE;
    } else {
      return KCellType.NUMBER;
    }
  } else if ( type == Cell.CELL_TYPE_STRING ) {
    return KCellType.LABEL;
  } else if ( type == Cell.CELL_TYPE_BLANK || type == Cell.CELL_TYPE_ERROR ) {
    return KCellType.EMPTY;
  } else if ( type == Cell.CELL_TYPE_FORMULA ) {
    switch ( cell.getCachedFormulaResultType() ) {
      case Cell.CELL_TYPE_BLANK:
      case Cell.CELL_TYPE_ERROR:
        return KCellType.EMPTY;
      case Cell.CELL_TYPE_BOOLEAN:
        return KCellType.BOOLEAN_FORMULA;
      case Cell.CELL_TYPE_STRING:
        return KCellType.STRING_FORMULA;
      case Cell.CELL_TYPE_NUMERIC:
        if ( HSSFDateUtil.isCellDateFormatted( cell ) ) {
          return KCellType.DATE_FORMULA;
        } else {
          return KCellType.NUMBER_FORMULA;
        }
      default:
        break;
    }
  }
  return null;
}
 
Example 16
Source File: ExcelDataReader.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Extracts the value of a particular cell depending on its type
 *
 * @param cell A populated Cell instance
 * @return Value of the cell
 */
private Object extractCellValue(Cell cell) {
    switch (cell.getCellType()) {
        case Cell.CELL_TYPE_NUMERIC:
            return cell.getNumericCellValue();
        case Cell.CELL_TYPE_BLANK:
        case Cell.CELL_TYPE_FORMULA:
        case Cell.CELL_TYPE_STRING:
            return cell.getStringCellValue();
        case Cell.CELL_TYPE_BOOLEAN:
            return cell.getBooleanCellValue();
        default:
            return cell.getStringCellValue();
    }
}
 
Example 17
Source File: Util.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private static void copyCell(Cell oldCell, Cell newCell, List<CellStyle> styleList) {
	if (styleList != null) {
		if (oldCell.getSheet().getWorkbook() == newCell.getSheet().getWorkbook()) {
			newCell.setCellStyle(oldCell.getCellStyle());
		} else {
			DataFormat newDataFormat = newCell.getSheet().getWorkbook().createDataFormat();

			CellStyle newCellStyle = getSameCellStyle(oldCell, newCell, styleList);
			if (newCellStyle == null) {

				Font oldFont = oldCell.getSheet().getWorkbook().getFontAt(oldCell.getCellStyle().getFontIndex());

				Font newFont = newCell.getSheet().getWorkbook().findFont(oldFont.getBoldweight(), oldFont.getColor(), oldFont.getFontHeight(),
						oldFont.getFontName(), oldFont.getItalic(), oldFont.getStrikeout(), oldFont.getTypeOffset(), oldFont.getUnderline());
				if (newFont == null) {
					newFont = newCell.getSheet().getWorkbook().createFont();
					newFont.setBoldweight(oldFont.getBoldweight());
					newFont.setColor(oldFont.getColor());
					newFont.setFontHeight(oldFont.getFontHeight());
					newFont.setFontName(oldFont.getFontName());
					newFont.setItalic(oldFont.getItalic());
					newFont.setStrikeout(oldFont.getStrikeout());
					newFont.setTypeOffset(oldFont.getTypeOffset());
					newFont.setUnderline(oldFont.getUnderline());
					newFont.setCharSet(oldFont.getCharSet());
				}

				short newFormat = newDataFormat.getFormat(oldCell.getCellStyle().getDataFormatString());
				newCellStyle = newCell.getSheet().getWorkbook().createCellStyle();
				newCellStyle.setFont(newFont);
				newCellStyle.setDataFormat(newFormat);

				newCellStyle.setAlignment(oldCell.getCellStyle().getAlignment());
				newCellStyle.setHidden(oldCell.getCellStyle().getHidden());
				newCellStyle.setLocked(oldCell.getCellStyle().getLocked());
				newCellStyle.setWrapText(oldCell.getCellStyle().getWrapText());
				newCellStyle.setBorderBottom(oldCell.getCellStyle().getBorderBottom());
				newCellStyle.setBorderLeft(oldCell.getCellStyle().getBorderLeft());
				newCellStyle.setBorderRight(oldCell.getCellStyle().getBorderRight());
				newCellStyle.setBorderTop(oldCell.getCellStyle().getBorderTop());
				newCellStyle.setBottomBorderColor(oldCell.getCellStyle().getBottomBorderColor());
				newCellStyle.setFillBackgroundColor(oldCell.getCellStyle().getFillBackgroundColor());
				newCellStyle.setFillForegroundColor(oldCell.getCellStyle().getFillForegroundColor());
				newCellStyle.setFillPattern(oldCell.getCellStyle().getFillPattern());
				newCellStyle.setIndention(oldCell.getCellStyle().getIndention());
				newCellStyle.setLeftBorderColor(oldCell.getCellStyle().getLeftBorderColor());
				newCellStyle.setRightBorderColor(oldCell.getCellStyle().getRightBorderColor());
				newCellStyle.setRotation(oldCell.getCellStyle().getRotation());
				newCellStyle.setTopBorderColor(oldCell.getCellStyle().getTopBorderColor());
				newCellStyle.setVerticalAlignment(oldCell.getCellStyle().getVerticalAlignment());

				styleList.add(newCellStyle);
			}
			newCell.setCellStyle(newCellStyle);
		}
	}
	switch (oldCell.getCellType()) {
	case Cell.CELL_TYPE_STRING:
		newCell.setCellValue(oldCell.getStringCellValue());
		break;
	case Cell.CELL_TYPE_NUMERIC:
		newCell.setCellValue(oldCell.getNumericCellValue());
		break;
	case Cell.CELL_TYPE_BLANK:
		newCell.setCellType(Cell.CELL_TYPE_BLANK);
		break;
	case Cell.CELL_TYPE_BOOLEAN:
		newCell.setCellValue(oldCell.getBooleanCellValue());
		break;
	case Cell.CELL_TYPE_ERROR:
		newCell.setCellErrorValue(oldCell.getErrorCellValue());
		break;
	case Cell.CELL_TYPE_FORMULA:
		newCell.setCellFormula(oldCell.getCellFormula());
		formulaInfoList.add(new FormulaInfo(oldCell.getSheet().getSheetName(), oldCell.getRowIndex(), oldCell.getColumnIndex(), oldCell.getCellFormula()));
		break;
	default:
		break;
	}
}
 
Example 18
Source File: ExcelUtils.java    From onetwo with Apache License 2.0 4 votes vote down vote up
public static void copyRow(Sheet worksheet, Row newRow, Row sourceRow) {
Workbook workbook = worksheet.getWorkbook();
      for (int i = 0; i < sourceRow.getLastCellNum(); i++) {
          Cell oldCell = sourceRow.getCell(i);
          Cell newCell = newRow.createCell(i);

          if (oldCell == null) {
              newCell = null;
              continue;
          }

          CellStyle newCellStyle = workbook.createCellStyle();
          newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
          newCell.setCellStyle(newCellStyle);

          if (oldCell.getCellComment() != null) {
              newCell.setCellComment(oldCell.getCellComment());
          }

          if (oldCell.getHyperlink() != null) {
              newCell.setHyperlink(oldCell.getHyperlink());
          }

          newCell.setCellType(oldCell.getCellType());

          switch (oldCell.getCellType()) {
              case Cell.CELL_TYPE_BLANK:
                  newCell.setCellValue(oldCell.getStringCellValue());
                  break;
              case Cell.CELL_TYPE_BOOLEAN:
                  newCell.setCellValue(oldCell.getBooleanCellValue());
                  break;
              case Cell.CELL_TYPE_ERROR:
                  newCell.setCellErrorValue(oldCell.getErrorCellValue());
                  break;
              case Cell.CELL_TYPE_FORMULA:
                  newCell.setCellFormula(oldCell.getCellFormula());
                  break;
              case Cell.CELL_TYPE_NUMERIC:
                  newCell.setCellValue(oldCell.getNumericCellValue());
                  break;
              case Cell.CELL_TYPE_STRING:
                  newCell.setCellValue(oldCell.getRichStringCellValue());
                  break;
          }
      }

      for (int i = 0; i < worksheet.getNumMergedRegions(); i++) {
          CellRangeAddress cellRangeAddress = worksheet.getMergedRegion(i);
          if (cellRangeAddress.getFirstRow() == sourceRow.getRowNum()) {
              CellRangeAddress newCellRangeAddress = new CellRangeAddress(newRow.getRowNum(),
                      (newRow.getRowNum() +
                              (cellRangeAddress.getLastRow() - cellRangeAddress.getFirstRow()
                                      )),
                      cellRangeAddress.getFirstColumn(),
                      cellRangeAddress.getLastColumn());
              worksheet.addMergedRegion(newCellRangeAddress);
          }
      }
  }
 
Example 19
Source File: ExcelUtil.java    From game-server with MIT License 4 votes vote down vote up
/**
 * 获取属性值
 *
 * @param cell
 * @param type
 * @return
 */
public static Object getCellValue(Cell cell, String type) {
    String cellValue = "";
    type = type.toLowerCase();
    if (cell == null) {
        //表格未填数据设置默认值
        switch (type) {
            case "int":
            case "short":
            case "byte":
            case "long":
                return 0;
            case "float":
            case "double":
                return 0.0;
            case "array":
                return new ArrayList<Document>();
            case "object":
                return new Document();
            case "boolean":
                return false;
            default:
                return cellValue;
        }
    }
    //把数字当成String来读,避免出现1读成1.0的情况
    if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
        cell.setCellType(Cell.CELL_TYPE_STRING);
    }
    //判断数据的类型
    switch (cell.getCellType()) {
        case Cell.CELL_TYPE_NUMERIC: //数字
            cellValue = String.valueOf(cell.getNumericCellValue());
            break;
        case Cell.CELL_TYPE_STRING: //字符串
            cellValue = String.valueOf(cell.getStringCellValue());
            break;
        case Cell.CELL_TYPE_BOOLEAN: //Boolean
            cellValue = String.valueOf(cell.getBooleanCellValue());
            break;
        case Cell.CELL_TYPE_FORMULA: //公式
            cellValue = String.valueOf(cell.getCellFormula());
            break;
        case Cell.CELL_TYPE_BLANK: //空值 
            cellValue = "";
            break;
        case Cell.CELL_TYPE_ERROR: //故障
            cellValue = "非法字符";
            break;
        default:
            cellValue = "未知类型";
            break;
    }
    if ("int".equalsIgnoreCase(type)) {
        return Integer.parseInt(cellValue);
    } else if ("long".equalsIgnoreCase(type)) {
        return Long.parseLong(cellValue);
    } else if ("byte".equalsIgnoreCase(type)) {
        return Byte.parseByte(cellValue);
    } else if ("short".equalsIgnoreCase(type)) {
        return Short.parseShort(cellValue);
    } else if ("Date".equalsIgnoreCase(type)) {
        return new Date(cellValue);
    } else if ("boolean".equalsIgnoreCase(type)) {
        return Boolean.parseBoolean(cellValue);
    } else if ("float".equalsIgnoreCase(type)) {
        return Float.parseFloat(cellValue);
    } else if ("double".equalsIgnoreCase(type)) {
        return Double.parseDouble(cellValue);
    } else if ("array".equalsIgnoreCase(type)) {
        return MongoUtil.getDocuments(cellValue);
    } else if ("object".equalsIgnoreCase(type)) {
        return MongoUtil.getDocument(cellValue);
    }

    return cellValue;
}
 
Example 20
Source File: SpreadsheetGetCellValue.java    From openbd-core with GNU General Public License v3.0 4 votes vote down vote up
public cfData execute( cfSession _session, List<cfData> parameters ) throws cfmRunTimeException {
	cfSpreadSheetData	spreadsheet = null;
	int rowNo, columnNo;
	
	/*
	 * Collect up the parameters
	 */
spreadsheet	= (cfSpreadSheetData)parameters.get(2);
rowNo				= parameters.get(1).getInt() - 1;
columnNo		= parameters.get(0).getInt() - 1;
		
if ( rowNo < 0 )
	throwException(_session, "row must be 1 or greater (" + rowNo + ")");
if ( columnNo < 0 )
	throwException(_session, "column must be 1 or greater (" + columnNo + ")");


/*
 * Find the cell in question 
 */
Sheet	sheet = spreadsheet.getActiveSheet();
Row row	= sheet.getRow( rowNo );
if ( row == null )
	row	= sheet.createRow( rowNo );

Cell cell	= row.getCell( columnNo );
if ( cell == null )
	cell = row.createCell( columnNo );

FormulaEvaluator evaluator = spreadsheet.getWorkBook().getCreationHelper().createFormulaEvaluator();

if ( cell.getCellType() == Cell.CELL_TYPE_BOOLEAN )
	return cfBooleanData.getcfBooleanData( cell.getBooleanCellValue() );
else if ( cell.getCellType() == Cell.CELL_TYPE_NUMERIC )
	return new cfNumberData( cell.getNumericCellValue() );
else if ( cell.getCellType() == Cell.CELL_TYPE_BLANK )
	return cfStringData.EMPTY_STRING;
else if ( cell.getCellType() == Cell.CELL_TYPE_STRING )
	return new cfStringData( cell.getStringCellValue() );
else if ( cell.getCellType() == Cell.CELL_TYPE_FORMULA ){
	CellValue cellValue = evaluator.evaluate(cell);
	
	switch (cellValue.getCellType()) {
		case Cell.CELL_TYPE_BOOLEAN:
			return cfBooleanData.getcfBooleanData(cellValue.getBooleanValue());
		case Cell.CELL_TYPE_NUMERIC:
			return new cfNumberData(cellValue.getNumberValue());
		case Cell.CELL_TYPE_STRING:
			return new cfStringData(cellValue.getStringValue());
		default:
			return cfStringData.EMPTY_STRING;
	}

}else
	return cfStringData.EMPTY_STRING;
}