I developed an Add-In for Excel so you can insert some numbers from a MySQL database into specific cells. Now I tried to format these cells to currency and I have two problems with that.
1. When using a formula on formatted cells, the sum for example is displayed like that:
“353,2574€”. What do I have to do to display it in an appropriate way?
2. Some cells are empty but have to be formatted in currency as well. When using the same format I used for the sum formula and type something in, there’s only the number displayed. No “€”, nothing. What is that?
I specified a Excel.Range and used this to format the range
sum.NumberFormat = "#.## €";
But I also tried
sum.NumberFormat = "0,00 €";
sum.NumberFormat = "#.##0,00 €";
Any idea someone?
This one works for me. I have excel test app that formats the currency into 2 decimal places with comma as thousand separator. Below is the Console Application that writes data on Excel File.
Make sure you have referenced Microsoft.Office.Interop.Excel dll
The Output