exceljs / exceljs

Excel Workbook Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken XLSX because of "vertical tab" ascii character in a cell

apydo opened this issue · comments

commented

Excel reports a broken xlsx file if there is an ascii code 0x0B or decimal 11 in a cell. It's also known as VT or "Vertical Tab". Excel consider this character as illegal in xml and the xlsx is broken if it's inside xml found in sharedStrings.xml file.

Is there any function that escapes illegal characters in a string before it's assigned to the cell ?

I have the same problem with the 'start of heading' character (ASCII code 1) that somehow sneaked into the generated content. I believe it should be handled by the library when XML-encoding. I guess the best place would be in xmlEncode function. I'll provide a PR soon.

commented

Thanks for the fix.

For your information the excluded characters in d072aa7 are not the only ones forbidden in XML.

This wikipedia page specifies what characters are allowed : https://en.wikipedia.org/wiki/Valid_characters_in_XML