Tuesday 15 February 2011

c# - Excel interop adding slashes in my number formatting string -



c# - Excel interop adding slashes in my number formatting string -

i'm trying set number format (south african rand currency, no decimals) range so:

range.numberformat = "_ r * # ##0_;";

where range of type microsoft.office.interop.excel.range

however when open spreadsheet , check formatting string choosing custom format string looks this:

_ \r * #\ ##0_;

and these added slashes means first one thousand separator (a space) nowadays , rest left off.

i've tried this:

range.numberformat = @"_ r * # ##0_;";

i tried msdn paricular doc reads gibberish me: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.numberformat.aspx

but same thing. know how prevent happening?

setting numberformatlocal property seems have solved me:

range.numberformatlocal = "_ r * # ##0_;";

no thought why though... , happy take more finish reply explains why there problem , why fixes it.

c# excel number-formatting excel-interop custom-formatting

No comments:

Post a Comment