Hello,
Hi,
Hi,
Hi Divya,
Thanks for your posting and using Aspose.Cells.
Actually, the type of cell B1 is string, therefore it cannot be converted to date time value and it throws exception.
Please see the following code and its debug output.
C#
Workbook workbook = new Workbook(“test.xls”);
Worksheet worksheet = workbook.Worksheets[0];
Debug.WriteLine(worksheet.Cells[“A1”].Type);
Debug.WriteLine(worksheet.Cells[“B1”].Type);
Debug.WriteLine(worksheet.Cells[“C1”].Type);
IsDateTime
IsString
IsDateTime
Hi Divya,
Thanks for using Aspose.Cells.
We have logged your original issue in our database for investigation. The time value in cell B2 of your Excel file is treated as string value and Cell.DateTimeValue throws exception.
We will investigate this issue and fix it. Once, the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
- CELLSNET-42921 - Time value in cell B2 is treated as string value.
Hi Divya,
Thanks for using Aspose.Cells.
Which tool did you use to create this file (test.xls)? The value of Cell B2 is a string
value. If you format cell as General in MS Excel, it does not change .In fact if
it’s a time value, it should became a double value.
If you created this file
with Aspose.Cells, please post your code.