public Sheet filterSheet(Sheet sheetToFilter){ if(sheetToFilter == null){ System.out.println("sheetToFilter is null!"); return null; } int lastRowNum = sheetToFilter.getLastRowNum(); int rowIndexI = 0; int rowIndexJ = 0; while(rowIndexI<=lastRowNum){ Row row = sheetToFilter.getRow(rowIndexI); if(row != null){ if(isVaildRow(row)){ if(rowIndexI>rowIndexJ){ shiftRows(rowIndexI,rowIndexI,rowIndexJ-rowIndexI); } rowIndexJ++; } else{ removeRow(row); } } rowIndexI++; } }
poi过滤操作后产生新的sheet,布布扣,bubuko.com
原文:http://www.cnblogs.com/hello-yz/p/3861601.html