public static void removeColumn(XSSFSheet sheet, int removeColumnNum, int removeColumnTotal){
if(sheet == null){
return;
}
for (Iterator<Row> rowIterator = sheet.rowIterator(); rowIterato
r.hasNext();) {
XSSFRow row = (XSSFRow)rowIterator.next();
XSSFCell cell = row.getCell(removeColumnNum);
if(cell == null){
continue;
}
row.removeCell(cell);
// for(int n = removeColumnNum; n < (removeColumnTotal + removeColumnNum); n ++){
// int columnWidth = sheet.getColumnWidth(n + 1);
//
// XSSFCell cell2 = row.getCell(n + 1);
//
// if(cell2 == null){
// break;
// }
// sheet.setColumnWidth(n, columnWidth);
// row.moveCell(cell2, (short)n);
// }
}
}
转载于:https://my.oschina.net/u/3503613/blog/1506564