Skip to content

Commit 945c490

Browse files
flangpaodb
authored andcommitted
fix: include last row of grid in exported excel file
Close #85
1 parent 4cff94b commit 945c490

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/flowingcode/vaadin/addons/gridexporter/ExcelInputStreamFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,16 @@ private int fillData(
245245
Row newRow = sheet.createRow(startingCell[0].getRowIndex() + 1);
246246
startingCell[0] = newRow.createCell(startingCell[0].getColumnIndex());
247247
startingCell[0].setCellStyle(cellStyle);
248-
// update the data range by updating last row
249-
dataRange.setLastRow(dataRange.getLastRow() + 1);
250248
}
249+
// update the data range by updating last row
250+
dataRange.setLastRow(dataRange.getLastRow() + 1);
251251
buildRow(t, sheet, startingCell[0]);
252252
notFirstRow[0] = true;
253253
});
254254
// since we initialized the cell range with the data placeholder cell, we use
255255
// the existing 'getLastColumn' to keep the offset of the data range
256256
dataRange.setLastColumn(dataRange.getLastColumn() + exporter.getColumns().size() - 1);
257-
return startingCell[0].getRowIndex();
257+
return dataRange.getLastRow();
258258
}
259259

260260
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)