首页 > 代码库 > poi过滤操作后产生新的sheet

poi过滤操作后产生新的sheet

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++;		}			}