开发者

Format Excel column as text [duplicate]

开发者 https://www.devze.com 2023-02-09 22:55 出处:网络
This question already has answers here: 开发者_JAVA百科 Closed 10 years ago. Possible Duplicate: C# extract formatted text from Excel through OLEDB
This question already has answers here: 开发者_JAVA百科 Closed 10 years ago.

Possible Duplicate:

C# extract formatted text from Excel through OLEDB

Can i somehow format an excel column and it's data as text, before fetching the data from it ? I'm using C# and .NET Framework 4.0


You can prefix the number by ' for example '100 will be shown as text.


Option 1

You can can try myCell.Style.NumberFormat = "@"

Here is an example online that should help give you an idea on how to use it:

  • Example

Option 2

Alternatively you could try grabing myCell.Text instead of myCell.Value. Value is what is actually stored in the cell, whereas Text is what is displayed.

0

精彩评论

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