Excel格式编号 [英] Excel Format Numbers

查看:78
本文介绍了Excel格式编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含数字的excel,有些数字显示一位小数,其中实际值包含2位小数,前显示0.3,当我选择该单元格时,其值为0.25



我的问题是我将excel文件保存为xlUnicodeText:

I have an excel which contain numeric and some numbers are displayed with one decimal where there actual value contain 2 decimals for ex it display 0.3 and when I select that cell its value is 0.25

My problem is I'm saving that excel file as xlUnicodeText:

xlSheet.SaveAs(FileName, Excel.XlFileFormat.xlUnicodeText)  



和我的文本文件中的数据显示为0.3。



如何将其作为真值0.25而不是显示在文本文件中并将其保存?


and the data in my text file are displaying it as 0.3.

How I can make it to take and save it in my text file as its true value 0.25 and not as it is displayed?

推荐答案

要以编程方式删除导致问题的格式,请尝试类似
To programmatically remove the formatting that is causing the problem try something like this
Excel.Range oRng = MySheet.UsedRange;   // or whatever range you need
oRng.NumberFormat = "General";

这也有效

This also works

oRng.NumberFormat = null;


你能试试吗?

http://social.msdn.microsoft.com/Forums/office/en-US/2465ee18-ba4c-49f9-bf30-e151699be103/excel-cell-format-issue?forum=exceldev [ ^ ]


这篇关于Excel格式编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆