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

Free Support Forum - aspose.com

Aspose.Cells changes time value whiling reading the datetime from excel cell?

I have created a excel file using Aspose.Cells. The attached file “testfile.xlsx” is actually created using Aspose. The first column of the worksheet has datetimes. Please open the file in excel and click on any date. You will see all the dates have the same time “4:06:05 PM”.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Now, I open the same file and I’m trying to read the cell value using Aspose framework using the following code. But the Time value return from the code below is different. Check the “seconds” part of the time, instead of 05 it returns 04

Why???

public void ReadExcelCell()
        {
            Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook("testfile.xlsx");
            object A1 = wb.Worksheets[0].Cells["A1"].Value;
            object A2 = wb.Worksheets[0].Cells["A2"].Value;
            object A3 = wb.Worksheets[0].Cells["A3"].Value;
            object A4 = wb.Worksheets[0].Cells["A4"].Value;
            object A5 = wb.Worksheets[0].Cells["A5"].Value;
            object A6 = wb.Worksheets[0].Cells["A6"].Value;
        }
 

UPDATE: I just checked the database. In the database the time value for all these dates is "16:06:04.577". This is the time value Apose used while creating the “testfile.xlsx” in the first place. So now question is why it does the rounding?

Nevermind, i think i know what is happing, Lets say the actual value is "2012-02-22 16:06:04.577" in the database. Aspose put this value in the cell without changing anything. Now i open the file manually in office excel, I see 4:06:05 instead of 4:06:04

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please also test your issue with the latest version:
Aspose.Cells for .NET v7.0.3.2
and let us know your feedback.