How do I fix the dollar symbol appearing at the end of amounts in exported Excel spreadsheets?
How do I fix the dollar symbol appearing at the end of amounts in exported Excel spreadsheets?
EdwinPS
Posts: 1Questions: 1Answers: 0
This is in Excel for Mac version 15.41. The cells seem to be formatted with type "Currency" but reselecting "$ Cherokee (United States)", which seems to be the default dollar symbol here, fixes the placement.
This discussion has been closed.
Answers
Hi Edwin,
I took a look at file "DataTables/Buttons .../js/buttons.html5.js"
According to this: https://datatables.net/reference/button/excelHtml5
Dollar Currency Values are built-in style 57.
This is built-in style 57:
As you can see it points to numFmtId 164.
This is that format id:
I copied this into Excel: #,##0.00_-\ [$$-45C] as a custom cell format.
and entered 88 this is the result: 88.00 $
Then I tried num format 166 ([$€-2]\ #,##0.00) which is Euro currency values and entered 88 and got this:
€ 88.00.
So works as designed I would say ... Question is does it make sense to have such a different rendering. The dollar rendering would be German style with the trailing dollar sign while the Euro rendering would be US style with the leading Euro sign. Opposite rendering would at least make more sense to me ...
Of course you can edit the buttons.html5.js file accordingly but then it gets overwritten in the next release. I used the customize function to add my own styles that won't get overwritten with a new release like this:
applying some of the styles in the customize function as well:
@rf1234 thx for the post, it helped me a lot to understand the whole thing.
This might be super hacky.... but it works... for now!
To piggy back on what @rf1234 said. The format is originally
So what this is doing is parsing through the styles, finding 164, and prepending the currency on it.