Hello everyone, i have the following problem and I come here looking for some advice.
I am using c#, but i have a dll that creates the excel file in Visual Basic.
i have a datagridview and the information there is exported to excel file. No problem there.
the problems is the following, in my datagridview i have a field that has almost 20 numbers(15 to 17).
in my datagrid the information is being displayed fine from the database. example
| col_Number |
|20120217082628888|
but the problem is when i export this data to excel.
i am using a template and the column where that number goes is currently formatted as general and the data is displayed like this
| col_Number |
| 2.01202E+16 |
if I apply the number format in the template the information goes like this
| col_Number |
|20120217082628800.00|
from the database the columns is
varchar(50)
, if i try to convert that to
bigint
, the winform gives me an error.
what i see is that when i convert to number, automatically is taking the last two digits away and replacing them with 0
20120217082628888 -- ORIGINAL
20120217082628800.00 -- AFTER NUMBER FORMAT
the code that I use in my dll to paste the information is the following.
For row As Integer = 1 To table2.Rows.Count - 1
For cols As Integer = 0 To table2.Columns.Count - 1
exlWsh.Cells(row + 1, cols + 1) = table2.Rows(row)(cols)
Next
Next
i dont do any format in any part of the code, that is done directly in the excel file.
any help will be appreciated.
Thanks...