Support for .NET Core 3.1 in Aspose.Cells for .NET

Hi
I have a customer that relies heavy on aspose.
We have upgraded our solution from .net core 2.2 to 3.1.
But now we get a problem with concatenate
We have this fomular:
=+CONCATENATE(“OS21100000000000000000000000000”;$B$1;$B$2;87644014;$B$4;“0000000000000”)
Which generate this output in .net core 2.2:
OS2110000000000000000000000000000010008764401400000000000000

But in .net core 3 or 3.1 the formular is changed to:
=+CONCATENATE(“OS21100000000000000000000000000”;$B$1;$B$2;87644013,9999999;$B$4;“0000000000000”)
and out ends up as
OS2110000000000000000000000000000010087644013,99999990000000000000

It has then rounded the number instead of keeping the format.
The original file is the same.
It can be fixed by added “” around 87644014.
But the problem is that i may be written like that in several hundred excel files and it would be impossible to find and fix them all.

Is this some sort of bug or ?

@nic11,

Thanks for the details.

Could you provide us a sample project (runnable) with template file to reproduce the issue, we will check it soon.

PS. please zip the project with template file prior attaching.

Test projects.zip (7.6 MB)

Hi Amjad
I have attached a file that contains a working .net core 2.2 project and a 3.1 project that is not working correctly.
The code is identical.

Would it be better to create a support ticket, since my customer has a license ?

@nic11,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNETCORE-46 – Number rounding issue while migrating solution from .NET Core 2.2 to 3.1

Thank you, can i some how follow the issue ?
How long time does it usually take before you can look into it ?

@nic11,
For simple issues it normally takes 3 to 5 days for providing the solution, however for complex issues it may take 2 to 3 weeks time. As this issue is logged to recently, therefore no ETA can be provided yet. We will write back here immediately once any update is ready to share.

1 Like

@nic11,

We hope that we will provide you the fixed version for testing in the next few days or so.

Keep in touch.

@nic11,
Please try our latest version/fix: Aspose.Cells for .NET v19.12.2:
Aspose.Cells19.12.2 For .Net4.0.Zip (5.0 MB)
Aspose.Cells19.12.2 For .NetStandard20.Zip (4.1 MB)
Aspose.Cells19.12.2 For .Net2_AuthenticodeSigned.Zip (5.0 MB)

Your issue should be fixed in it.

Let us know your feedback.

I will test it now, thank you :slight_smile:

It works, thank you :slight_smile:

@nic11,

Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

1 Like

Problem statement:

Excel cells provide incorrect values for mathematical formulas (Addition, subtraction, division, multiplication, etc.) with latest stable Aspose.Cells nuget (20.1.0).

Details:

We have an application in .net core 3.1 that reads data from excel files and performs some operations based on these readings. This application works fine for simple excel data. But, if there is any mathematical equation (i.e. subtraction, addition, multiplication, division, etc.), then the output is different than the expected value.

To prove this, we created one sample POC in .net core 3.1 that reads excel cells and writes the values in console. The excel file has two decimal numbers (1.035, 2.897) on cell A1 and B1 and summation of the same in cell C1

Expected output for C1 : 3.932

Actual output for C1: 3.9319999999999995

I am attaching the POC for your reference.

Steps to run POC:

  1. Extract the zip file
  2. Open solution in Visual Studio
  3. Compile and run the project (.NET Core 3.1 sdk required)
    Let me know in case of any query.

GetCellValuesFromExcelUsingAspose.zip (9.0 KB)

@tirtht,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNETCORE-51 – Round off issue while adding fractions

@tirtht,
We have thoroughly investigated the issue and observed that this issue occurs because of .netcore 3.1 changes it’s double to string logic.
Please try this code:

double dv = 3.9319999999999995; 
Console.WriteLine(dv);

In .netcore 2.2, the output is 3.932,
In .netcore 3.1, the output is 3.9319999999999995.

So come back to CELLSNETCORE-51, when you try

"Console.WriteLine("Cell value is " + cell.Value);",

“cell.Value” is an object, actually it’s a double,
so the problem occurs in .netcore 3.1 as the reason we mentioned before.

Similarly note that CELLSNETCORE-51 is different from CELLSNETCORE-46,
In CELLSNETCORE-46, our ouput is like:

(OS21100000000,$B$1,$B$2,87644014,$B$4,000000000),

so “87644014” or “87644013.99999999” is A Part Of The Formula String,
In CELLSNETCORE-46, we can do some operation to keep the whole formula string the same as .netcore2.2.
For CELLSNETCORE-51, we suggest you do it like this(that is what we do for CELLSNETCORE-46 in sealed method):

double dv = cell.Value;
Console.WriteLine(dv.ToString("#.##############", CultureInfo.InvariantCulture));

Actually, this seems to be an issue with .NET Core 2.2 itself, which might have been fixed with .NET Core 3.1.
Also, if you check the example, ideally, cell.Value should always be 3.932. Why would it return 3.9319999999999995 for a simple decimal numbers?
There was a fix mentioned for CELLSNETCORE-46 above, would that work in this case?

@tirtht,

We are analyzing your concerns and will share our feedback soon.

@tirtht,
The fact that cell.Value does not return 3.932 but 3.9319999999999995 is because in the template file it is saved as 3.9319999999999995, not 3.932. What you see in ms excel is not always the actual value in the data model and template file. As we have said, ms excel uses 15 digits to display numeric values, so if you need to get the same with ms excel, you should format the numeric value with the same rule. Lower versions of .net core do round numeric values to 15 digits for double to string by default, so you can get the same result with what shown in ms excel. But it seems .net core 3.x changes this behavior which make the output different.

For “this seems to be an issue with .NET Core 2.2 itself, which might have been fixed with .NET Core 3.1.”.