poi 删除一列

```
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);
//		          }
		  }
		 }
```
赞 (0) 评论 分享 ()