0

I'm using this function by export html table to excel file.

function ExportToExcel() {
    var htmltabel = document.getElementById("tabella_finale");
    var html = htmltabel.outerHTML;
    window.open('data:application/vnd.ms-excel,'+ encodeURI(html)); 
}

it works correctly but when I open .xlsx file , euro symbol doesn't show correctly. It shows

€ 90.15

instead of

€90.15

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
Rob
  • 1
  • 1
  • 1
    This appears to be JavaScript, not PHP, correct? Also, you do understand that this is not creating an Excel file, it is creating an HTML file that the client is encouraged to treat as one. – Chris Haas Jan 19 '22 at 14:17
  • 1
    This seems relevant: https://stackoverflow.com/q/25730008/231316 – Chris Haas Jan 19 '22 at 14:20
  • ok but how can I resolve this issue or do you know other function that can do this? – Rob Jan 19 '22 at 14:20
  • It might be easier to export to csv, Excel will have no issues reading it.. – aland Jan 19 '22 at 14:25
  • It must be excel – Rob Jan 19 '22 at 14:27
  • Please only tag questions with languages that are relevant to the code you provided. If you are hoping or willing to accept code in additional languages, that is not what the tags are intended for. – Chris Haas Jan 19 '22 at 15:05
  • i resolve it bu using tabe 2 excel grab it from github https://github.com/linways/table-to-excel. It works like a charm – Rob Jan 19 '22 at 15:08
  • @chris-haas, I have a really simple solution but you closed the question! I can't post the answer – Fasoeu Jan 19 '22 at 15:15
  • Yes, sorry, I've seen it right now! – Fasoeu Jan 19 '22 at 15:17

0 Answers0