org.apache.poi.ss.usermodel.Cell.getBooleanCellValue()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(366)

本文整理了Java中org.apache.poi.ss.usermodel.Cell.getBooleanCellValue()方法的一些代码示例,展示了Cell.getBooleanCellValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cell.getBooleanCellValue()方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Cell
类名称:Cell
方法名:getBooleanCellValue

Cell.getBooleanCellValue介绍

[英]Get the value of the cell as a boolean.

For strings, numbers, and errors, we throw an exception. For blank cells we return a false.
[中]以布尔值形式获取单元格的值。
对于字符串、数字和错误,我们抛出一个异常。对于空白单元格,我们返回false。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public Object getValue() {
 try {
  switch ( getType() ) {
   case BOOLEAN_FORMULA:
   case BOOLEAN:
    return Boolean.valueOf( cell.getBooleanCellValue() );
   case DATE_FORMULA:
   case DATE:
    // Timezone conversion needed since POI doesn't support this apparently
    //
    long time = cell.getDateCellValue().getTime();
    long tzOffset = TimeZone.getDefault().getOffset( time );
    return new Date( time + tzOffset );
   case NUMBER_FORMULA:
   case NUMBER:
    return Double.valueOf( cell.getNumericCellValue() );
   case STRING_FORMULA:
   case LABEL:
    return cell.getStringCellValue();
   case EMPTY:
   default:
    return null;
  }
 } catch ( Exception e ) {
  throw new RuntimeException( "Unable to get value of cell ("
   + cell.getColumnIndex() + ", " + cell.getRowIndex() + ")", e );
 }
}

代码示例来源:origin: stackoverflow.com

switch (evaluator.evaluateFormulaCell(cell)) {
  case Cell.CELL_TYPE_BOOLEAN:
    System.out.println(cell.getBooleanCellValue());
    break;
  case Cell.CELL_TYPE_NUMERIC:

代码示例来源:origin: org.apache.poi/poi-ooxml

writeAttribute("t", "b");
_out.write("><v>");
_out.write(cell.getBooleanCellValue() ? "1" : "0");
_out.write("</v>");
break;

代码示例来源:origin: org.apache.poi/poi

break;   
case BOOLEAN:   
  destCell.setCellValue(srcCell.getBooleanCellValue());   
  break;   
case ERROR:

代码示例来源:origin: org.apache.poi/poi

return CellValue.valueOf(cell.getBooleanCellValue());
case ERROR:
  return CellValue.getError(cell.getErrorCellValue());

代码示例来源:origin: org.apache.poi/poi

sval = String.valueOf(cell.getBooleanCellValue()).toUpperCase(Locale.ROOT);

代码示例来源:origin: looly/hutool

break;
case BOOLEAN:
  value = cell.getBooleanCellValue();
  break;
case FORMULA:

代码示例来源:origin: looly/hutool

break;
case BOOLEAN:
  value = cell.getBooleanCellValue();
  break;
case FORMULA:

代码示例来源:origin: org.apache.poi/poi

if (comp instanceof ErrorEval) continue; // nothing to check
if (comp instanceof BoolEval) {
  if (isType(cell, CellType.BOOLEAN) && ((BoolEval) comp).getBooleanValue() == cell.getBooleanCellValue() ) {
    return true;
  } else {

代码示例来源:origin: org.apache.poi/poi

return cell.getBooleanCellValue() ? "TRUE" : "FALSE";
case BLANK :
  return "";

代码示例来源:origin: org.apache.poi/poi

return apply(label, "");
case BOOLEAN:
  return apply(label, c.getBooleanCellValue());
case NUMERIC:
  Double value = c.getNumericCellValue();

代码示例来源:origin: org.apache.poi/poi

return apply("");
case BOOLEAN:
  return apply(c.getBooleanCellValue());
case NUMERIC:
  Double value = c.getNumericCellValue();

代码示例来源:origin: org.apache.poi/poi

&& (eval2 == BlankEval.instance || eval2 instanceof BoolEval) 
) {
return operator.isValid(cell.getBooleanCellValue(), eval == BlankEval.instance ? null : ((BoolEval) eval).getBooleanValue(), eval2 == BlankEval.instance ? null : ((BoolEval) eval2).getBooleanValue());

代码示例来源:origin: org.apache.poi/poi-ooxml

break;
case BOOLEAN:
  setCellValue(srcCell.getBooleanCellValue());
  break;
case ERROR:

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

private static Object getValue(Cell cell, CellType type) {
  switch (type) {
    case NUMERIC: // In excel the date is NUMERIC Type
      if (DateUtil.isCellDateFormatted(cell)) {
        return LocalDateTimeValue.localDateTime(cell.getDateCellValue().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
      }
      double value = cell.getNumericCellValue();
      if (value == Math.floor(value)) return (long) value;
      return value;
    case STRING: return cell.getStringCellValue();
    case FORMULA: return getValue(cell,cell.getCachedFormulaResultTypeEnum());
    case BOOLEAN: return cell.getBooleanCellValue();
    case _NONE: return null;
    case BLANK: return null;
    case ERROR: return null;
    default: return null;
  }
}

代码示例来源:origin: mrdear/JavaWEB

break;
case Cell.CELL_TYPE_BOOLEAN:
 value = y.getBooleanCellValue();
 break;
case Cell.CELL_TYPE_NUMERIC:

代码示例来源:origin: arnaudroger/SimpleFlatMapper

@Override
public Boolean get(Row target) throws Exception {
  final Cell cell = target.getCell(index);
  if (cell != null) {
    return cell.getBooleanCellValue();
  } else {
    return null;
  }
}

代码示例来源:origin: arnaudroger/SimpleFlatMapper

@Override
  public boolean getBoolean(Row target) throws Exception {
    final Cell cell = target.getCell(index);
    if (cell != null) {
      return cell.getBooleanCellValue();
    } else {
      return false;
    }
  }
}

代码示例来源:origin: xresloader/xresloader

static private Boolean cal_cell2bool(Cell c, CellValue cv) {
  if (null == cv) {
    return c.getBooleanCellValue();
  }
  return cv.getBooleanValue();
}

代码示例来源:origin: org.datanucleus/datanucleus-excel

public boolean fetchBooleanField(int fieldNumber)
{
  Cell cell = sheet.getRow(rowNumber).getCell(getColumnMapping(fieldNumber).getColumn(0).getPosition());
  if (cell == null)
  {
    return false;
  }
  return cell.getBooleanCellValue();
}

相关文章