piyush
piyush

Reputation: 45

Issue while reading an Excel through adapter which was written through npoi

Steps I am doing:

  1. First I exported some rows into excel(97-2003 format) using NPOI. Columns actually are string fields, date fields and time fields but when exported into excel they were converted into string(General in terms of Excel format).
  2. Now if suppose I open the above formed excel and update few cells(specially date/time columns), excel converts that cells to date/time format.
  3. Now when I read this excel file using OLEDB Adapter, it reads the cells that were converted to date/time fields but other cells in same column in string format throws error.

Upvotes: 1

Views: 265

Answers (1)

Graham
Graham

Reputation: 11

The NPOI examples have an example of setting date values in cells (SetDateCellInXls). This has two methods of writing dates, the first setting the cell style to a date format (the example is in Chinese, but should be easy to use your locale). The second is to use a formula to enter the date.

Hopefully one of these will solve your problem

Upvotes: 1

Related Questions