I'm trying to generate a excel file using VB in visual studio 2010, using the NPOI library. I ran into the issue where the data inserted are format incorrectly.
For example, I have a user id "0001"
, and I'm trying to inserted into excel.
In the output excel file, the cell says "1"
which is incorrect. I looked at the format and it already says "Text" and not "General".
How can I go about inserting "0001"
correctly instead of "1"
?
I tried this and it's no making any changes
myStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("text")
I tried "@"
as well and also doesn't make any changes.
Any help is appreciated.
Make sure you set the CellType to String if you don't already.
Or in C# try: