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

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

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

Cell.getCellTypeEnum介绍

[英]Return the cell type.
[中]

代码示例

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

/**
 * 获取单元格值
 * 
 * @param cell {@link Cell}单元格
 * @param isTrimCellValue 如果单元格类型为字符串,是否去掉两边空白符
 * @return 值,类型可能为:Date、Double、Boolean、String
 */
public static Object getCellValue(Cell cell, boolean isTrimCellValue) {
  return getCellValue(cell, cell.getCellTypeEnum(), isTrimCellValue);
}

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

/**
 * 获取单元格值
 * 
 * @param cell {@link Cell}单元格
 * @param isTrimCellValue 如果单元格类型为字符串,是否去掉两边空白符
 * @return 值,类型可能为:Date、Double、Boolean、String
 */
public static Object getCellValue(Cell cell, boolean isTrimCellValue) {
  return getCellValue(cell, cell.getCellTypeEnum(), isTrimCellValue);
}

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

/**
 * 获取单元格值
 * 
 * @param cell {@link Cell}单元格
 * @param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作
 * @return 值,类型可能为:Date、Double、Boolean、String
 */
public static Object getCellValue(Cell cell, CellEditor cellEditor) {
  if (null == cell) {
    return null;
  }
  return getCellValue(cell, cell.getCellTypeEnum(), cellEditor);
}

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

/**
 * 获取单元格值
 * 
 * @param cell {@link Cell}单元格
 * @param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作
 * @return 值,类型可能为:Date、Double、Boolean、String
 */
public static Object getCellValue(Cell cell, CellEditor cellEditor) {
  if (null == cell) {
    return null;
  }
  return getCellValue(cell, cell.getCellTypeEnum(), cellEditor);
}

代码示例来源:origin: kiegroup/optaplanner

protected boolean currentRowIsEmpty() {
  if (currentRow.getPhysicalNumberOfCells() == 0) {
    return true;
  }
  for (Cell cell : currentRow) {
    if (cell.getCellTypeEnum() == CellType.STRING) {
      if (!cell.getStringCellValue().isEmpty()) {
        return false;
      }
    } else if (cell.getCellTypeEnum() != CellType.BLANK) {
      return false;
    }
  }
  return true;
}

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

cellType = cell.getCellTypeEnum();

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

cellType = cell.getCellTypeEnum();

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

private static Object[] extract(Row row, Selection selection) {
  // selection.updateHorizontal(row.getFirstCellNum(),row.getLastCellNum());
  Object[] result = new Object[selection.right-selection.left];
  for (int i = selection.left; i < selection.right; i++) {
    Cell cell = row.getCell(i);
    if (cell == null) continue;
    result[i-selection.left] = getValue(cell, cell.getCellTypeEnum());
  }
  return result;
}

代码示例来源:origin: com.github.mygreen/excel-cellformatter

@Override
public boolean isText() {
  return cell.getCellTypeEnum() == CellType.STRING;
}

代码示例来源:origin: com.github.mygreen/excel-cellformatter

@Override
public boolean isBoolean() {
  return cell.getCellTypeEnum() == CellType.BOOLEAN;
}

代码示例来源:origin: com.github.mygreen/excel-cellformatter

@Override
public boolean isNumber() {
  return cell.getCellTypeEnum() == CellType.NUMERIC;
}

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 获取单元格值
 * 
 * @param cell {@link Cell}单元格
 * @param isTrimCellValue 如果单元格类型为字符串,是否去掉两边空白符
 * @return 值,类型可能为:Date、Double、Boolean、String
 */
public static Object getCellValue(Cell cell, boolean isTrimCellValue) {
  return getCellValue(cell, cell.getCellTypeEnum(), isTrimCellValue);
}

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

private static String getStringCell(Sheet sheet, int rowIndex, int colIndex) {
  assert sheet != null;
  Row row = sheet.getRow(rowIndex);
  if (row == null) {
    return "?"; //$NON-NLS-1$
  }
  Cell cell = row.getCell(colIndex);
  if (cell == null || cell.getCellTypeEnum() != CellType.STRING) {
    return "?"; //$NON-NLS-1$
  }
  return cell.getStringCellValue();
}

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

private String getStringCell(Sheet sheet, int rowIndex, int colIndex) {
  assert sheet != null;
  Row row = sheet.getRow(rowIndex);
  if (row == null) {
    return null;
  }
  Cell cell = row.getCell(colIndex);
  if (cell == null || cell.getCellTypeEnum() != CellType.STRING) {
    return null;
  }
  return cell.getStringCellValue();
}

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 获取单元格值
 * 
 * @param cell {@link Cell}单元格
 * @param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作
 * @return 值,类型可能为:Date、Double、Boolean、String
 */
public static Object getCellValue(Cell cell, CellEditor cellEditor) {
  if (null == cell) {
    return null;
  }
  return getCellValue(cell, cell.getCellTypeEnum(), cellEditor);
}

代码示例来源:origin: io.github.aktoluna/slnarch-common

public static Object getCellValue(final Workbook workbook, final Cell cell) {
 Object cellValue = null;
 if (cell.getCellTypeEnum() == CellType.STRING) {
  cellValue = getCellValueAsString(cell);
 } else if (cell.getCellTypeEnum() == CellType.NUMERIC) {
  cellValue = getNumericCellValue(cell);
 } else if (cell.getCellTypeEnum() == CellType.BOOLEAN) {
  cellValue = getCellValueAsBool(cell);
 } else if (cell.getCellTypeEnum() == CellType.FORMULA) {
  cellValue = evaluateCellFormula(workbook, cell);
 }
 return cellValue;
}

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

private Object readCellValue(Cell cell) {
  return readCellValue(cell, cell.getCellTypeEnum());
}

代码示例来源:origin: com.github.mygreen/excel-cellformatter

/**
 * エラーセルの値を評価する。
 * @param cell
 * @param locale
 * @return
 */
private CellFormatResult getErrorCellValue(final Cell cell, final Locale locale) {
  final CellType cellType = cell.getCellTypeEnum();
  assert cellType == CellType.ERROR;
  return getErrorCellValue(cell.getErrorCellValue(), locale);
}

代码示例来源:origin: org.spdx/spdx-tools

@SuppressWarnings("deprecation")
protected String getDataCellStringValue(int colNum) {
  Cell cell = getDataRow().getCell(colNum);
  if (cell == null) {
    return null;
  } else {
    if (cell.getCellTypeEnum() == CellType.NUMERIC) {				
      return Double.toString(cell.getNumericCellValue());
    } else {
      return cell.getStringCellValue();
    }
  }
}

代码示例来源:origin: spdx/tools

@SuppressWarnings("deprecation")
protected String getDataCellStringValue(int colNum) {
  Cell cell = getDataRow().getCell(colNum);
  if (cell == null) {
    return null;
  } else {
    if (cell.getCellTypeEnum() == CellType.NUMERIC) {				
      return Double.toString(cell.getNumericCellValue());
    } else {
      return cell.getStringCellValue();
    }
  }
}

相关文章