You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using streaming SXSSFWorkbook, generate a simple spreadsheet output
Issue Description
The generated xlsx file contains a stray UTF8 BOM (ZWNBSP) character in xl\worksheets\sheet1.xml between <sheetData><row r="1">.
The file can be opened without issue in Excel, however importing this file into PowerBI results in the error message "'Text' is an invalid XmlNodeType, Line 1, position x"
On investigation, it appears the temp file created for streaming is done so using a UTF8 encoding (SheetDataWriter.cs constructor), this then forces the temp file to contain the UTF8 BOM character, which then appears to be inserted into the final spreadsheet just after the opening <sheetData> tag
The text was updated successfully, but these errors were encountered:
The stray UTF8 BOM character is within the xl\worksheets\sheet1.xml file just after the opening <sheetData> tag.
As for importing into PowerBI, this is a process that our customers do with the generated spreadsheets and is not something we do ourselves; it has now been reported by multiple customers, each customer with their own use cases and processes.
We were previously using the non-streaming XSSF functions to generate the files, and these were generated without issue, it is only since switching to the streaming SXSSF functions that the issue has started.
This problem is not specific to PowerBI, it is creating a malformed document, it's just that Excel must work around it when opening the files. It seems to be a simple case of needing to remove this override to the encoding in the SheetDataWriter:
The vast majority of StreamWriters in the solution don't use the override, and rely on the the default encoding, which is UTF8NoBOM:
NPOI Version
Current
File Type
Reproduce Steps
Using streaming SXSSFWorkbook, generate a simple spreadsheet output
Issue Description
The generated xlsx file contains a stray UTF8 BOM (ZWNBSP) character in xl\worksheets\sheet1.xml between
<sheetData><row r="1">
.The file can be opened without issue in Excel, however importing this file into PowerBI results in the error message "'Text' is an invalid XmlNodeType, Line 1, position x"
On investigation, it appears the temp file created for streaming is done so using a UTF8 encoding (SheetDataWriter.cs constructor), this then forces the temp file to contain the UTF8 BOM character, which then appears to be inserted into the final spreadsheet just after the opening
<sheetData>
tagThe text was updated successfully, but these errors were encountered: