/** * Remove a row by its index * @param sheet a Excel sheet * @param rowIndex a 0 based index of removing row */ public static void removeRow(HSSFSheet sheet, int rowIndex) { int lastRowNum=sheet.getLastRowNum(); if(rowIndex>=0&&rowIndex<lastRowNum){ sheet.shiftRows(rowIndex+1,lastRowNum, -1); } if(rowIndex==lastRowNum){ HSSFRow removingRow=sheet.getRow(rowIndex); if(removingRow!=null){ sheet.removeRow(removingRow); } } }
HSSFSheet sheet = workBook.getSheetAt(0); HSSFRow row = sheet.getRow(0); sheet.removeRow(row);
public static void removeRow(HSSFSheet sheet, int rowIndex) { int lastRowNum=sheet.getLastRowNum(); if(rowIndex>=0&&rowIndex<lastRowNum){ sheet.shiftRows(rowIndex+1,lastRowNum, -1); } if(rowIndex==lastRowNum){ HSSFRow removingRow=sheet.getRow(rowIndex); if(removingRow!=null){ sheet.removeRow(removingRow); } } }
HSSFSheet hoja = wb.getSheetAt(0); HSSFRow fila = hoja.getRow(numFila); hoja.removeRow(fila); hoja.shiftRows(numFila+1, hoja.getLastRowNum(), -1);
/** * Remove a row by its index * @param sheet a Excel sheet * @param rowIndex a 0 based index of removing row */ public static void removeRow(HSSFSheet sheet, int rowIndex) { int lastRowNum=sheet.getLastRowNum(); if(rowIndex>=0&&rowIndex<lastRowNum){ sheet.shiftRows(rowIndex+1,lastRowNum, -1); } if(rowIndex==lastRowNum){ HSSFRow removingRow=sheet.getRow(rowIndex); if(removingRow!=null){ sheet.removeRow(removingRow); } } }
sheet.removeRow(removingRow);
sheet.removeRow(lastRow);
HSSFRow removingRow = sheet.getRow(row_count_post_1); if (removingRow != null) { sheet.removeRow(removingRow);