Example usage for org.apache.poi.ss.usermodel CellValue TRUE

List of usage examples for org.apache.poi.ss.usermodel CellValue TRUE

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel CellValue TRUE.

Prototype

CellValue TRUE

To view the source code for org.apache.poi.ss.usermodel CellValue TRUE.

Click Source Link

Usage

From source file:com.miraisolutions.xlconnect.data.ColumnBuilder.java

License:Open Source License

protected CellValue getCachedCellValue(Cell cell) {
    int valueType = cell.getCellType();
    if (valueType == Cell.CELL_TYPE_FORMULA) {
        valueType = cell.getCachedFormulaResultType();
    }//from  w w w .j  av a 2s . c  o m
    switch (valueType) {
    case Cell.CELL_TYPE_BLANK:
        return null;
    case Cell.CELL_TYPE_BOOLEAN:
        if (cell.getBooleanCellValue()) {
            return CellValue.TRUE;
        } else {
            return CellValue.FALSE;
        }
    case Cell.CELL_TYPE_NUMERIC:
        return new CellValue(cell.getNumericCellValue());
    case Cell.CELL_TYPE_STRING:
        return new CellValue(cell.getStringCellValue());
    case Cell.CELL_TYPE_ERROR:
        return CellValue.getError(cell.getErrorCellValue());
    default:
        String msg = String.format("Could not extract value from cell with cached value type %d", valueType);
        throw new RuntimeException(msg);
    }
}