Free Support Forum - aspose.com

Time cell export not correct

Hi,

in attched document the “Handel bis” entitled column contains time value in 24H mode (20:00 o clock). When I call ExportDataTableAsString() the value gets imported as “08:00” instead of “20:00”.

Can you help?

Regards,

Try this fix, please.

Hi Laurence,

thanks for your reply. I tested the fix but with no effect.

Regards,

My test code and all work fine:

Excel excel = new Excel();
excel.Open(“d:\test\equities_3.xls”);
DataTable dt = excel.Worksheets[0].Cells.ExportDataTableAsString(1, 17, 2, 2, false);
Console.WriteLine(dt.Rows[0][1]);

The output string are :

20:00
20:00

Please download v3.3 at www.aspose.com/downloads and make sure the old dll is replaced.

Hi Laurence,

ok, I think I know what the problem is. When the celll is formatted as text or user-defined as hh:mm everything is fine.

But when I explicitly set the format of the cell in excel to "Time" the export still reads the value as "08:00" instead of "20:00". See attached excel document. Here is my code:



Excel excel = new Excel();
Console.WriteLine("Assembly: {0}", excel.GetType().Assembly.GetName());
excel.Open(@"c:\test.xls");

DataTable dt = excel.Worksheets[0].Cells.ExportDataTableAsString(0, 0, excel.Worksheets[0].Cells.MaxDataRow+1, excel.Worksheets[0].Cells.MaxDataColumn+1, true);
foreach (DataRow row in dt.Rows)
Console.WriteLine("Value #1: {0}\tValue #2: {1}\tValue #3: {2}", row[0], row[1], row[2]);

Thanks for your information. I will fix it in the next release.

Hi Laurence,

thanks. Can you tell me when this will be? We are currently in QA of our product and if it will take too long, I would have to do a fix on my own…

Regards,

Please try this attached fix.

Great software, great support. Thank you very much. Now everything works fine!!!

Big Smile