Free Support Forum -

ASP.NET to Excel Date Fields Converted to Julian

Hi, when importing a dataview to Aspose.Cells, and then to Excel, the date fields show as a number (Julian i think) instead of as a date. I believe one date was showing something like 31546. Here's some of the code which which is performing this operation. So, how can i make date fields show with proper date format? Thanks!

Dim lic As New License


'create a new workbook object...
Dim wb As Workbook = New Workbook

'add a new sheet to the workbook...

'get the reference of the newly added worksheet by passing its sheet index...
Dim ws As Worksheet = wb.Worksheets(0)

'get our dataview object...
Dim sPONo As String = txtPO_Input.Text
Dim sPartNo As String = txtPartInput.Text
Dim ds As New DataSet
Call subLoadDataSet(sPONo, sPartNo, ds)

Dim dvw As DataView = New DataView(ds.Tables(0))

ws.Cells.ImportDataView(dvw, True, 0, 0, 1000, 100, True)

'import save the excel file to an HTTP Response stream which will send it to
'the client and ask them to open or save it…
wb.Save("po.xls", FileFormatType.Default, SaveType.OpenInExcel, Response)


Please use Cells.ImportDataTable(DataTable dataTable, bool isFieldNameShown, int firstRow, int firstColumn, int rowNumber, int columnNumber, bool insertRows, string dateFormatString) method to import data.

We will look into overload the ImportDataView with dateFormatString property.