代码拉取完成,页面将自动刷新
cell.setCellValue("");请将这句代码移至删除之前。 @jueyue @dbinary 麻烦修改一下,并更新一下 easypoi-base,这里急用
/**
* 先判断删除,省得影响效率
*
* @param sheet
* @param map
* @throws Exception
*/
private void deleteCell(Sheet sheet, Map<String, Object> map) throws Exception {
Row row = null;
Cell cell = null;
int index = 0;
while (index <= sheet.getLastRowNum()) {
row = sheet.getRow(index++);
if (row == null) {
continue;
}
for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) {
cell = row.getCell(i);
if (row.getCell(i) != null && (cell.getCellType() == CellType.STRING
|| cell.getCellType() == CellType.NUMERIC)) {
cell.setCellType(CellType.STRING);
String text = cell.getStringCellValue();
if (text.contains(IF_DELETE)) {
cell.setCellValue("");
if (Boolean.valueOf(
eval(text.substring(text.indexOf(START_STR) + 2, text.indexOf(END_STR))
.trim(), map).toString())) {
PoiSheetUtil.deleteColumn(sheet, i);
i--;
}
}
}
}
}
}