开发者

Column fromate problem while reading Excel in c#

开发者 https://www.devze.com 2022-12-20 12:02 出处:网络
I am able to read the excel sheet from c# + asp.net application with MS interop Excel services (namespace). Data retrieving fine. But my excel sheet have a colummn whose formate type is of hh:mm:ss ty

I am able to read the excel sheet from c# + asp.net application with MS interop Excel services (namespace). Data retrieving fine. But my excel sheet have a colummn whose formate type is of hh:mm:ss type. while retriving data i found value of this column fetching as开发者_Go百科 General column getting some 0.45645646... like value. What should this problem is. rewind that in Excel sheet column formate is Custom as hh:mm:ss type as per requirement. Please guide .


Your question is not clear.

Do you want to set the number format to "hh:mm:ss"? If so you can do:

worksheet.Cells["A1"].NumberFormat = "hh:mm:ss";

Do you want to get the formatted value of the cell as a string?

string formattedValue = worksheet.Cells["A1"].Text;

If it is something else, please try to make your question clearer.

0

精彩评论

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