Bug 64732 - XSSFSheet.createTable generates corrupted file when a header's cell contains a line break
Summary: XSSFSheet.createTable generates corrupted file when a header's cell contains ...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.1.2-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-10 08:54 UTC by Olivier Levrey
Modified: 2020-09-10 17:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Levrey 2020-09-10 08:54:21 UTC
After calling XSSFSheet.createTable using an AreaReference with a cell containing a line break in a column header, the generated Excel file is corrupted.

Everything is described in detail here: https://stackoverflow.com/questions/63814180/apache-poi-createtable-generates-corrupted-file-when-a-headers-cell-contains-a
Comment 1 Nick Burch 2020-09-10 09:25:43 UTC
A quick check shows that XSSFDataValidation has code to do this encoding, and XSSFRichTextString has code to do the decoding

Would it make sense to pull that out to a util method (XMLHelper? StringUtil? other?) for re-use, then call that for the Table header case too?
Comment 2 PJ Fanning 2020-09-10 17:08:15 UTC
Hi Nick - sharing the code in a util makes sense
Comment 3 PJ Fanning 2020-09-10 17:10:18 UTC
XMLHelper would probably be a good place