Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Thu Sep 20, 2007 9:37 am

Hi


I want to export datatable into excel file but the column in which datetime is present shows only date part and time part shows 12:00:00 AM.
Please suggest some remedy for this problem.I am using Imports Spire.DataExport.XLS namespace and CellExport1.DataFormats.DateTime = "M-d-yyyy H:mm"

CellExport1.SaveToHttpResponse("res.xls", Response)

This is very urgent.

Thanks in advance...........

sgohane
 
Posts: 3
Joined: Thu Sep 20, 2007 9:13 am

Thu Sep 20, 2007 1:56 pm

Hello,

Try to format datetime value in GetDataParams event of Spire.DataExport, see following code.


Code: Select all
   private void cellExport1_GetDataParams(object sender, Spire.DataExport.EventArgs.DataParamsEventArgs e)
      {
         if    ((e.Sheet == 0) && (e.Col == 6))
         {
            e.FormatText = "M-d-yyyy H:mm";
         }
      }

DataExport
 
Posts: 35
Joined: Thu Jun 29, 2006 2:29 pm

Fri Sep 21, 2007 7:01 am

Thanks for your suggestion but it was of no use instead of i given string format specifer for datetime in datatable

sgohane
 
Posts: 3
Joined: Thu Sep 20, 2007 9:13 am

Return to Spire.DataExport