Bug 64732

Summary: XSSFSheet.createTable generates corrupted file when a header's cell contains a line break
Product: POI Reporter: Olivier Levrey <olivier.levrey>
Component: XSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 4.1.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

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