|
@@ -366,13 +366,15 @@ public class ExcelUtil {
|
|
|
PageIterator extract = new ObjectExtractor(document).extract();
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
|
Sheet sheet = workbook.createSheet("Sheet1");
|
|
|
+ int preEndRowIndex =0;
|
|
|
while (extract.hasNext()) {
|
|
|
Page next = extract.next();
|
|
|
List<technology.tabula.Table> tableList = new SpreadsheetExtractionAlgorithm().extract(next);
|
|
|
for (technology.tabula.Table table : tableList) {
|
|
|
List<List<RectangularTextContainer>> rows = table.getRows();
|
|
|
- for (int rowNum = 0; rowNum < rows.size(); rowNum++) {
|
|
|
- Row sheetRow = sheet.createRow(rowNum);
|
|
|
+ int rowLength = rows.size();
|
|
|
+ for (int rowNum = 0; rowNum < rowLength; rowNum++) {
|
|
|
+ Row sheetRow = sheet.createRow(rowNum + preEndRowIndex);
|
|
|
List<RectangularTextContainer> textContainerList = rows.get(rowNum);
|
|
|
for (int cellNum = 0; cellNum < textContainerList.size(); cellNum++) {
|
|
|
Cell cell = sheetRow.createCell(cellNum);
|
|
@@ -382,6 +384,7 @@ public class ExcelUtil {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ preEndRowIndex = preEndRowIndex + rowLength -1;
|
|
|
}
|
|
|
}
|
|
|
// 将Excel工作簿写入输出流
|