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
时间: 2024-10-23 22:54:11