We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

String.Format(CultureInfo.GetCultureInfo("de-DE").NumberFormat, "{0:0.00}", someValue) does not format

I am trying to format outside of Syncfusion a String for a Cell in an EXCEL-file.
But the result in c# is not the same as in Excel, I need need a pricision of 2 digit without any currency sign.

This works:

String.Format(CultureInfo.GetCultureInfo("de-DE"), "{0:C}", someValue)

But that is not what I am looking for.

I need 2 digits and no sign, that is what I tried:

 String.Format(CultureInfo.GetCultureInfo("de-DE").NumberFormat, "{0:0.00}", someValue)

How to do this ?

1 Reply

AV Abirami Varadharajan Syncfusion Team December 21, 2016 11:52 AM UTC

Hi Peter, 
Thank you for contacting Syncfusion support. 
As you are assigning value to the cell by appending two digits along with decimal, it gets ignored as per MS Excel behavior. 
So, we request you to apply Number format to the cell to achieve your requirement. Kindly refer below code snippet to achieve the same. 
Code Example: 
worksheet.Range["A10"].Value = "10000"; 
worksheet.Range["A10"].NumberFormat = "0.00"; 
Please let us know if you have any concerns. 

Live Chat Icon For mobile
Up arrow icon