remove Helper class
This commit is contained in:
parent
a7c64b99ef
commit
0f19017581
|
@ -1,21 +0,0 @@
|
|||
package com.baeldung.poi.excel.insert;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class InsertRowHelper {
|
||||
public Workbook insertRowBetweenRows(String fileLocation, int startRow, int rowNumber) throws IOException {
|
||||
Workbook workbook = new XSSFWorkbook(fileLocation);
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
int lastRow = sheet.getLastRowNum();
|
||||
if (lastRow < startRow) {
|
||||
sheet.createRow(startRow);
|
||||
}
|
||||
sheet.shiftRows(startRow, lastRow, rowNumber, true, true);
|
||||
sheet.createRow(startRow);
|
||||
return workbook;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue