xou/elixlsx

Can't use "&" in sheet name

Closed this issue · 1 comments

Hi there, I've encountered a problem when a sheet's name contains an & character the generated file can't be opened by excel.

To reproduce:
%Workbook{sheets: [%Sheet{name: "elix & lsx"}]} |> Elixlsx.write_to("elixlsx-test.xlsx")

At first I thought that maybe & characters were not allowed in sheet names, but I can use them when working within excel, is this an expected behavior?

ps. Thanks for your work on this library!

Thank's for reporting this bug!

The cause for this, is that & is a special char of XML. If you use & instead it should work.

General we should validate and replace special chars before we put user input to the XML template.
I will fix this next days.