private static void gettingTheCellContents(CellReference cellRef, Cell cell,
XSSFWorkbook workbook) {

        DataFormatter formatter = new DataFormatter();
        FormulaEvaluator formulaEvaluator =
workbook.getCreationHelper().createFormulaEvaluator();
        formatter.formatCellValue(cell,formulaEvaluator);

        switch (cell.getCellTypeEnum()) {
            case STRING:
               
System.out.println(cell.getRichStringCellValue().getString());
                break;
            case NUMERIC:
                if (DateUtil.isCellDateFormatted(cell)) {
                    System.out.println(cell.getDateCellValue());
                } else {
                    System.out.println(cell.getNumericCellValue());
                }
                break;
            case BOOLEAN:
                System.out.println(cell.getBooleanCellValue());
                break;
            case FORMULA:
                System.out.println(cell.getCellFormula());
                break;
            case BLANK:
                System.out.println();
                break;
            default:
                System.out.println();
        }
    }

------------------------------------------

Output is :
C34

But I need cell-value as output...



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Getting-the-cell-contents-tp5728401p5728405.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to