https://bz.apache.org/bugzilla/show_bug.cgi?id=62444
Bug ID: 62444
Summary: Newline character in table header row cell causes
damage to Excel file
Product: POI
Version: 3.17-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Overview
If there is a newline (or perhaps a carriage return) in the text of a header
cell in a table in an XSSFSheet, when the workbook is written out by POI and
then read by Excel, Excel reports some unreadable content in the workbook.
Steps to Reproduce
1) Use Excel to prepare a workbook that has a table in the first sheet.
2) Select a header cell in the table, and enter text containing a new-line in
the cell. In Excel 2011 for Mac, this is done with the keystroke combination
cmd-option-return.
3) Save the workbook.
4) Read and then write the workbook using the following POI code:
final File testFile = new File(srcFile.getParentFile(), "test.xlsx");
final InputStream is = new FileInputStream(srcFile);
final XSSFWorkbook wb = (XSSFWorkbook) WorkbookFactory.create(is);
is.close();
try (OutputStream fileOut = new FileOutputStream(testFile)) {
wb.write(fileOut);
wb.close();
}
5) Open the workbook in Excel. You will get warning message about repairing
unreadable content; when you examine the repair log file, you will get the
following information:
Repair Result to test 04744.xml
Errors were detected in file ‘[path redacted]:test.xlsx'
Repaired Records: Table from /xl/tables/table1.xml (List)
This has been seen in version 3.17 of POI, on Macintosh running OS X 10.11.6,
using Excel 2011 for Mac
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]