Don't skip empty cells on export

Make sure we output at least an empty string as a placeholder.
Fixes #2306
This commit is contained in:
Tom Morris 2020-06-21 23:16:46 -04:00
parent 7a1451f561
commit 9b8e750550

View File

@ -80,10 +80,8 @@ final class SpreadsheetSerializer implements TabularSerializer {
for (int c = 0; c < cells.size(); c++) { for (int c = 0; c < cells.size(); c++) {
CellData cellData = cells.get(c); CellData cellData = cells.get(c);
if (cellData != null && cellData.text != null) {
cellDatas.add(cellData2sheetCellData(cellData)); cellDatas.add(cellData2sheetCellData(cellData));
} }
}
rowData.setValues(cellDatas); rowData.setValues(cellDatas);
rows.add(rowData); rows.add(rowData);
@ -98,7 +96,11 @@ final class SpreadsheetSerializer implements TabularSerializer {
com.google.api.services.sheets.v4.model.CellData sheetCellData = new com.google.api.services.sheets.v4.model.CellData(); com.google.api.services.sheets.v4.model.CellData sheetCellData = new com.google.api.services.sheets.v4.model.CellData();
ExtendedValue ev = new ExtendedValue(); ExtendedValue ev = new ExtendedValue();
if (cellData == null || cellData.value == null) {
ev.setStringValue("");
} else {
ev.setStringValue(cellData.value.toString()); ev.setStringValue(cellData.value.toString());
}
sheetCellData.setUserEnteredValue(ev); sheetCellData.setUserEnteredValue(ev);