excel interop : NumberFormat #,##0.000 doesn't display the expected result

孤者浪人 提交于 2019-12-12 03:54:10

问题


I developed a C# utility class called ExcelGenerator that generate a List of objects to excel. I want to display double numbers in this format : 3 288,523.

NumberFormat = "#,##0.000" doesn't display the expected result

This is the method :

public void FormatNombre(string frm)
{
_excel.Selection.NumberFormat = frm;
}

and this is the call :

eg.FormatNombre("#,##0.000");

Number still displayed like this : 3288,522.542


回答1:


You want to format 3288523.542 to 3 288,523?

Try something like this:

[>999]#" "###","###;#

Edit: Just noticed looks like you are trying use French: Try this format.

# ##0,000


来源:https://stackoverflow.com/questions/15791922/excel-interop-numberformat-0-000-doesnt-display-the-expected-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!