Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Sat Jan 30, 2021 8:04 am

Hi,
I'm facing this problem:
When reading a cell formatted as Date, the property HasDateTime seem to be resetted while the HasNumber property is setted.
In the attached file , you can find two cells A1 is formatted as date when a non default format and when reading it isn't recognized as DateTime (HasDateTime is resetted) while the B1 cell is date formatted with the excel default value and that's correctly recognized ad DateTime.

The same effect when the cell content results from a formula

Thank you
Attachments
datetime.zip
(6.98 KiB) Downloaded 133 times

nda_tech
 
Posts: 12
Joined: Fri Jan 29, 2021 5:42 pm

Mon Feb 01, 2021 11:08 am

Hello,

Thanks for your inquiry.
For the data in the cell "A2" of the file you provided, we are sorry to tell you that our Spire.XLS does not support this type of date format. But there is an alternative solution, you can refer to the following code to determine whether the data is a date. Feel free to contact us if you have further questions.
Code: Select all
            Workbook wb = new Workbook();
            wb.LoadFromFile("datetime.xlsm");
            CellRange cellRangeB = wb.Worksheets[0].Range["A2"];
            String dateTimeValue = cellRangeB.DisplayedText;         
            DateTime date = new DateTime();
            bool result = DateTime.TryParse(dateTimeValue, out date);


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Feb 01, 2021 11:54 am

Hi
thank you for the feedback
The problem with my application is that i don't know which type of cell I'm dealing with , i.e. I don't have a fixed excel format , the dateformat cell may be in any cell
Anyway my workaround is to examine the numbeformat string
Thanks anyway

Ncola

nda_tech
 
Posts: 12
Joined: Fri Jan 29, 2021 5:42 pm

Tue Feb 02, 2021 2:02 am

Hello Ncola,

Thanks for your response.

Anyway, I’m glad to hear that you found the workaround.

Besides, we will consider adding a new feature to our further upgrade list to support this type of data format. If it can be achieved in the future, we will let you know.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Feb 23, 2021 9:53 am

Hello Ncola,

Glad to inform you that we just released Spire.XLS Pack(Hotfix) Version:11.2.6 which fixes your issue, please download it from the following links to test on your side. Looking forward to your testing result.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.XLS/11.2.6

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Fri Feb 26, 2021 6:32 am

Hello Ncola,

Greetings from E-iceblue.
Does this hotfix solve your issue? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
Last edited by Brian.Li on Fri Feb 26, 2021 7:59 am, edited 1 time in total.
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Fri Feb 26, 2021 7:20 am

Hi,
thank you for the fix, but I'm using FreeSpire , so I cannot test the patch.
Sincerly
Nicola

nda_tech
 
Posts: 12
Joined: Fri Jan 29, 2021 5:42 pm

Fri Feb 26, 2021 9:23 am

Hello Nicola,

Thanks for your reply.
I am sorry that we currently only fixed the issue in our latest commercial version. We only upgrade the free version irregularly. Apologize for the inconvenience caused.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS