main
黄海 2 years ago
parent 61d135fcc9
commit ab525e9873

@ -530,7 +530,7 @@ public class CollectController extends Controller {
Record r = cm.getSheetConfig(upload_excel_filename_finish, i);
int data_start_row = r.getInt("data_start_row");
//恢复背景色
//PoiUtil.resetStyle(wb, sheet, data_start_row);
PoiUtil.resetStyle(wb, sheet, data_start_row);
//数据有效行数
int lastRowNum = sheet.getLastRowNum();
@ -567,12 +567,12 @@ public class CollectController extends Controller {
}
}
}
// int sheet_index = 1;
// int row_index = 3;
// int col_index = 7;
// XSSFCell cell2 = wb.getSheetAt(sheet_index).getRow(row_index).getCell(col_index);
// Object value2 = PoiUtil.getValue(cell2);
// System.out.println(value2);
int sheet_index = 1;
int row_index = 3;
int col_index = 7;
XSSFCell cell2 = wb.getSheetAt(sheet_index).getRow(row_index).getCell(col_index);
Object value2 = PoiUtil.getValue(cell2);
System.out.println(value2);
// 检查数据类型是不是和规定的不兼容
for (int j = data_start_row; j <= lastRowNum; j++) {//行

@ -107,7 +107,13 @@ public class PoiUtil {
for (int row = dataStartRow; row <= sheet.getLastRowNum(); row++) {
for (int col = 0; col < sheet.getRow(row).getLastCellNum(); col++) {
Cell cell = sheet.getRow(row).getCell(col);
fillColor(wb, cell, IndexedColors.WHITE.getIndex());
// 创建单元格样式
CellStyle style = cell.getCellStyle();
// 设置背景颜色
style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 应用样式到单元格
cell.setCellStyle(style);
}
}
}

Loading…
Cancel
Save