开发者

Currency export to Excel results in  character for empty space

I am essentially exporting a webpage to Excel format. The export works fine, but when exporting Currency values that were formatted ToString("C") results in displaying the  character in the Excel cell before any space in the money value. For Example: decimal Invoice = 322800.38; decimal All开发者_开发技巧ocated = 695.55;

Label1.Text = Invoice.ToString("C"); Label2.Text = Allocated.ToString("C");

After the export the value in excel is: R 322 827,27 (Wrong) and R 695,55 (Correct)

Any ideas? Thank you


That's actually caused by a mis-interpretation of the encoding used to save it, when you have a hard space (160), usually given as   in a web page. It looks like the web page is encoded as UTF8, but you're loading it into windows 'ANSI' format.

It depends on precisely what you're doing and how you're exporting, but you need to either change the encoding of the web page, or have excel use the encoding it was exported to when you import it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜