Class ExcelCellUtils

java.lang.Object
icu.easyj.poi.excel.util.ExcelCellUtils

public abstract class ExcelCellUtils extends Object
获取单元格的值的 工具类
Author:
wangliang181230
  • Constructor Details

    • ExcelCellUtils

      public ExcelCellUtils()
  • Method Details

    • isEmptyCell

      public static boolean isEmptyCell(org.apache.poi.ss.usermodel.Cell cell)
      判断是否为空单元格
      Parameters:
      cell - 单元格
      Returns:
      isEmptyCell是否为空单元格
    • getCellValue

      public static Object getCellValue(org.apache.poi.ss.usermodel.Cell cell)
      获取单元格的值
      Parameters:
      cell - 单元格
      Returns:
      cellValue 单元格的值
    • getCellValue

      public static Object getCellValue(org.apache.poi.ss.usermodel.Cell cell, ExcelCellMapping cellMapping)
      获取单元格的值
      Parameters:
      cell - 单元格
      cellMapping - 列映射
      Returns:
      cellValue 单元格的值
    • getCellValue

      public static <T> T getCellValue(org.apache.poi.ss.usermodel.Cell cell, Class<T> targetClass)
      获取单元格的值
      Type Parameters:
      T - 目标类型
      Parameters:
      cell - 单元格
      targetClass - 目标类
      Returns:
      cellValue 单元格的值
    • setCellValue

      public static void setCellValue(org.apache.poi.ss.usermodel.Cell cell, Object data, ExcelCellMapping cellMapping) throws NoSuchFieldException
      设置单元格的值
      Parameters:
      cell - 单元格
      data - 数据
      cellMapping - 列映射
      Throws:
      NoSuchFieldException - 字段未找到的异常
    • setCellStyle

      public static void setCellStyle(org.apache.poi.ss.usermodel.Sheet sheet, ExcelMapping mapping, int headRowNum, boolean isBeforeWriteFile)
      设置列样式
      Parameters:
      sheet - 表格
      mapping - 表格映射
      headRowNum - 头行号
      isBeforeWriteFile - 是否在写文件前
    • convertAlign

      public static org.apache.poi.ss.usermodel.HorizontalAlignment convertAlign(String align, @Nullable org.apache.poi.ss.usermodel.HorizontalAlignment defaultAlign)
    • convertVerAlign

      public static org.apache.poi.ss.usermodel.VerticalAlignment convertVerAlign(String verAlign, @Nullable org.apache.poi.ss.usermodel.VerticalAlignment defaultVerAlign)