This project is read-only.

Can not manually edit/add dates in Excel to a NPOI created sheet

Oct 15, 2010 at 3:40 AM

DescriptionIf NPOI 1.2.3 creates a workbook with 1 sheet and 1 cell of text (or anything) then I edit that sheet in

Excel 2007, i can not add or edit any dates as the sheet seems to be in some kind of "expecting a formula" kind of

mode. Entering 12/12/2010 will show "0.000498" or if i format as date "0/01/1900". It forces a "=" in front of my

date. If i create a new sheet in that workbook, then it allows me to enter and add dates on the new sheet as

Sample code:
Dim xlWorkbook As NPOI.HSSF.UserModel.HSSFWorkbook
Dim xlSheet As NPOI.HSSF.UserModel.HSSFSheet
Dim xlRow As NPOI.HSSF.UserModel.HSSFRow
Dim xlCell As NPOI.HSSF.UserModel.HSSFCell

xlWorkbook = New NPOI.HSSF.UserModel.HSSFWorkbook()
xlSheet = xlWorkbook.CreateSheet()
xlRow = xlSheet.CreateRow(0)
xlCell = xlRow.CreateCell(0)

Using fs As New IO.FileStream("c:\web\npoi-test.xls", IO.FileMode.Create)
End Using


SetCellValue type is string, then i output the excek,set the cellvalue  '2010-09-01' then the excel will add '=' in the value then the cellvalue is '=2010-09-01'

Oct 15, 2010 at 3:42 AM

this condition don't happen in the version,so i want to know the reason.