Workbook workbook = GcExcelUtils.getWorkBook();
workbook.open("F:\\testDemo.xlsx");
IWorksheet worksheet = workbook.getWorksheets().get(0);
IRange lastRange = worksheet.getRange(0, worksheet.getUsedRange().getLastColumn());
System.out.println(worksheet.getUsedRange().getLastColumn());
if ("错误提示".equals(lastRange.getText())) {
String column = ColumnIndexToName(lastRange.getColumn());
worksheet.getRange(String.format("%s:%s", column, column)).getEntireColumn().delete();
}
System.out.println(worksheet.getUsedRange().getLastColumn());
这是测试代码
这个是结果
demo 我再附件里提供了
|