Hi ,
In our application I am using Infragistics.Excel to export the file. But I am not able to apply the Currency format for numeic values. Please how can i specify the currency format.
Ex:- 10,235.00 Ex: 0
Could you please respond soon will be appreciable because this is our immediate requirement and going to production today EOD.
Code snippet:-
Right now I am converting the value to string and applying the format. This cause the different problems. so please let me know the proper solution. If provide the sample application to me will be great helpful to me...
if (value != null && value.ToString() == "0") cell.Value = value.ToString(); else cell.Value = string.Format("{0:0,0}", value); cell.CellFormat.VerticalAlignment = VerticalCellAlignment.Center; cell.CellFormat.Alignment = HorizontalCellAlignment.Right;
Hi Mike,
Thanks for your Quick reply and informing me about finding the Format. It worked.
But One doubt when I apply the Percentage. value is being multiplied by 100.
For ex:- value is 2 But In excel shows 200%.
Please let me know the solution...
The format for percentage (with 2 decimal places) is 0.00%
By the way, you can find these strings by right-clicking on a cell a choosing "Format Cells...", going to the "Number" tab, selecting the format you need, and then going to the "Custom" category at the bottom. In the "Type" text box on the right, you will see the format string.
Mike,
Thanks for your Quick response.I have applied the following format.
cell.Value = value; cell.CellFormat.FormatString = "#,##0;(#,##0);0";
It is working fine. But now its not working for %. Could you please paste me the format string for Percentage.
Thanks
Anil Kumar
The default currency format in Excel is this: $#,##0.00
Set this on the cell.CellFormat.FormatString property.