xml to excel 2003 issue with datetime
I am using XML to generate Excel 2003 dynamically.
All works good, but when I am trying to put datetime with data type =
"DateTime", excel is not generating and it is throwing error.
sw.Write("<Cell ss:StyleID=\"s21\"><Data ss:Type=\"DateTime\">" +
Convert.ToDateTime(dsReportData.Rows[i]["close_time"]).ToString("M/D/YYYY
H:MM") + "</Data></Cell>\r\n");
sw.Write("<Cell ss:StyleID=\"s22\"><Data ss:Type=\"String\">" +
dsReportData.Rows[i]["close_time"].ToString() + "</Data></Cell>\r\n");
First line code throws error, while the 2nd works perfect, but I want as a
data type = "DateTime".
Is there any work around?
No comments:
Post a Comment