Open vaadin-bot opened 9 years ago
Originally by wuuemm
Attachment added: abiclients_TBF.xlsx
(11.5 KiB)
Sample Excel file causing problem
Originally by wuuemm
A attach a file. Use case: create a Spreadsheet based on that (new Spreadshet(<file>)
). Then write()
. And open in MS Excel.
Originally by juanitae@fireapps.com
We are also seeing this problem. In our case, the badly written file contained a date-formatted cell that was converted to a number field during the process, though we cannot tell if this was the result of write or repair, though excel reported a problem with the same styles.xml file referenced in the original defect description.
Originally by wuuemm
In my case the problem seemed to be related primarily to fonts. My working workaround:
XSSFWorkbook workbook = (XSSFWorkbook) spreadsheet.getWorkbook();
int nf = workbook.getNumberOfFonts();
for (short i = 0; i < nf; i++) {
workbook.getFontAt(i).setFamily(FontFamily.NOT_APPLICABLE);
}
This is called just before spreadsheet.write()
Originally by wuuemm
Under some circimstances,
write()
method creates files, which MS Excel cannot read and wants to repair. If repaired, those files usually lack formatting and the last row.This happens, when the Spreadsheet was created by reading an existing Excel file. No problems I faced, when the spreadsheet (and underlying Workbook) was created from the scratch.
The issue must be related to styling in some way. If no styles are applied, everything works well. What MS Escel usually reports after repair is that
<removedPart>
is/xl/styles.xml with an XML error
.No exceptions are thrown when writing.
What's interesting, Mac OSX's Preview can read the file without problems and shows it properly. MS Excel cannot, though.
This seems to be not related to particular Excel version (Mac, Windows)
Imported from https://dev.vaadin.com/ issue #17973