Package icu.easyj.poi.excel.util
Class ExcelRowUtils
java.lang.Object
icu.easyj.poi.excel.util.ExcelRowUtils
Excel行 工具类
- Author:
- wangliang181230
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateDataRows(org.apache.poi.ss.usermodel.Sheet sheet, List<?> dataList, ExcelMapping mapping) 创建数据行static voidcreateHeadRow(org.apache.poi.ss.usermodel.Sheet sheet, ExcelMapping mapping) 创建头行static intgetCellNumByHead(org.apache.poi.ss.usermodel.Row headRow, int cellNum, ExcelCellMapping cellMapping) 根据头行获取当前列号static booleanisEmptyRow(org.apache.poi.ss.usermodel.Row row) 判断是否为空行static booleanisHeadRow(org.apache.poi.ss.usermodel.Row row, ExcelMapping mapping) 根据映射信息,判断该行是否为头行static <T> TrowToObject(org.apache.poi.ss.usermodel.Row row, boolean hasNumberCell, org.apache.poi.ss.usermodel.Row headRow, Class<T> clazz, ExcelMapping mapping) 行数据转换为映射的类对象
-
Constructor Details
-
ExcelRowUtils
public ExcelRowUtils()
-
-
Method Details
-
rowToObject
@NonNull public static <T> T rowToObject(org.apache.poi.ss.usermodel.Row row, boolean hasNumberCell, org.apache.poi.ss.usermodel.Row headRow, Class<T> clazz, ExcelMapping mapping) throws Exception 行数据转换为映射的类对象- Type Parameters:
T- 数据类型- Parameters:
row- 行hasNumberCell- 是否有序号列headRow- 头行clazz- 数据类mapping- 表格映射- Returns:
- rowObj 行数据对象
- Throws:
Exception- 异常
-
getCellNumByHead
public static int getCellNumByHead(org.apache.poi.ss.usermodel.Row headRow, int cellNum, ExcelCellMapping cellMapping) 根据头行获取当前列号- Parameters:
headRow- 头行cellNum- 列号cellMapping- 列映射- Returns:
- cellNum 列号
-
isHeadRow
根据映射信息,判断该行是否为头行- Parameters:
row- 行mapping- 表格映射- Returns:
- isHeadRow 是否为头行
-
isEmptyRow
public static boolean isEmptyRow(org.apache.poi.ss.usermodel.Row row) 判断是否为空行- Parameters:
row- 行- Returns:
- isEmptyRow 是否为空行
-
createHeadRow
创建头行- Parameters:
sheet- 表格mapping- 表格映射
-
createDataRows
public static void createDataRows(org.apache.poi.ss.usermodel.Sheet sheet, List<?> dataList, ExcelMapping mapping) 创建数据行- Parameters:
sheet- 表格dataList- 数据列表mapping- 表格映射
-