hhurz / tableExport.jquery.plugin

jQuery plugin to export a html table to JSON, XML, CSV, TSV, TXT, SQL, Word, Excel, PNG and PDF
MIT License
984 stars 714 forks source link

How to export values to XLSX as currency format? #350

Closed CryptocurrencyZ closed 2 years ago

hhurz commented 2 years ago

The currency format is not supported by the current version.

hhurz commented 2 years ago

Version 1.26.0 contains a new option mso.xlsx.formatid.currency, which allows you to specify the format string for exporting currency values.

Since currency values cannot be detected automatically, cells containing currency values must be marked with the data attribute 'tableexport-xlsxformatid' set to 164. Example <td data-tableexport-xlsxformatid="164">1.84</td>

The default format string used for mso.xlsx.formatid.currency is '$#,##0.00;[Red]-$#,##0.00', which you can of course customize for your needs. For Euro you could use '#,##0.00 €;[Red](#,##0.00) €'