We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Displayed DateTime-Values are not equal to Array-Values

Hi,

If I want to read a DateTime-Value i get a Value that is changed by -1 second by the displayed value.

Displayed-Value: 17.03.2009 00:00:00
Read-Value: 16.03.2009 23:59:59
XML-Value: 39888.999999942127
Code:
dt = Range.Worksheet.Cells.ExportArray(StartRow, StartColumn, EndRow, EndColumn)

How do i get the rounded displayed Value?

Hi,


Thanks for your posting and using Aspose.Cells.

Please try the following code, it works good. Please see this screenshot of the exported data table. Let us know your feedback.

C#
Workbook wb = new Workbook(“Kopie.xlsx”);

Worksheet ws = wb.Worksheets[0];

DataTable o = ws.Cells.ExportDataTableAsString(0, 0, 2, 2);

Hi,

thanks for your reply.

The ExportDatatableAsString-method works fine. But we want to get a date-object.
Is there any solution for the exportArray-method?
The same problem occurs, if i use workbook.cells.item(0,0).Value.

Kind Regards,
Manuel Memenga


Hi,


Well, for your requirement, we do just same with MS Excel for formatting DateTime values. In fact, the DateTime object contains
milliseconds 995. In MS Excel, it will be rounded to the nearest second when the
formatting has no millisecond part. If you need the DateTime object, you should use exportArray method and do the correct formatting by yourself according
to your requirements.

Thank you.