···
Field[] declaredFields = ImportAppKeyApplyInfoDTO.class.getDeclaredFields();
Row headerRow = sheet.createRow(0);
for (int i = 0; i < declaredFields.length; i++) {
Field declaredField = declaredFields[i];
Excel annotation = declaredField.getAnnotation(Excel.class);
// 避免测试覆盖率影响jacco自动多加了个$jacocoData属性
if (null == annotation) {
continue;
}
double width = annotation.width();
Cell cell = headerRow.createCell(i);
cell.setCellValue(annotation.name());
sheet.setColumnWidth(i, (int) width * 256); // 宽度设置,单位为 1/256 字符宽度
cell.setCellStyle(getWrapCellStyle(workbook));
}
···
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交