Open khiav223577 opened 4 years ago
Does it make sense to retain such (escaped) characters in sheet names? In cells for example they are removed, see Cell#clean_value which calls Axlsx.sanitize which removes control characters.
@noniq I'm not sure which is better, removing or escaping non-printable ASCII characters in sheet names. If it is undocumented or is undefined behavior, it's best to be removed. if it is a valid name, it make sense to retain it.
My gut feeling is that non-printable characters should not be allowed to be part of a sheet name. Are there any references to what constitutes a valid sheet name in the Excel docs?
I didn't find any references about what to do with non-printable characters :thinking:. Either removing or escaping is okay to me.
Would you like to prepare a pull request? axlsx is currently unmaintained though, so please create the pull request in the https://github.com/caxlsx/caxlsx repository (that's the actively maintained community fork).
The worksheet name was escaped as HTML since https://github.com/randym/axlsx/issues/112. But It seems to be not working with some special characters, "\b" character for example. I think it should be escaped as XML.
See: https://support.microsoft.com/en-us/help/315580/prb-error-message-when-an-xml-document-contains-low-order-ascii-charac
Steps to reproduce
aslsx
.Axlsx::Package.new do |p| p.workbook.add_worksheet(:name => "My sheet\b") do |sheet| sheet.add_row ["Data1", "Data2"] end p.serialize('simple1.xlsx') end
The produced excel file
simple2.xlsx
works fine.