mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 664 forks source link

Format escaping broken #258

Open Troopster19 opened 4 years ago

Troopster19 commented 4 years ago

Using a style of : -$*`` #,##0.00-;-$ #,##0.00-;-$ "-"??-;-@- gets converted in numberFormatStandardized to: -\$\ #,##0.00_-;-\$\ #,##0.00-;-\$*\ "-"??-;-@_- and causes slashes to be visible in the cell. Changing line 811 to $escaped.= $c; instead of $escaped.= "\".$c; fixed it.

Not sure what the intended purpose of escaping those characters was but it breaks custom formats.

mk-j commented 1 year ago

XLSX is really just a zip of XML files. So when your write the numberFormat to XML you have to escape some characters to match excel. So I get that the escaping isn't working correctly for your format... but it would be interesting to see what your format looks like in the raw xml file within the xlsx file to see how it gets escaped.