Get wrong decimal value of cells when read excel file after upgrade new version of Aspose

I have trouble reading the decimal value of cells in an excel file when upgrading the system to use the new version of Aspose.
It only happens with cells having value is “1.36” and the Format cell is number in excel file.
With the value “0.36”, “2.36”, or other, the error is not happening.

Here is my code:
DataTable dt = new DataTable();
using (Workbook wb = new Workbook(stream))
{
using (Worksheet ws = wb.Worksheets[workSheetName])
{
ExportTableOptions options = new ExportTableOptions();
for (int i = 0; i <= ws.Cells.MaxDataColumn + 1; i++)
{
dt.Columns.Add().DataType = typeof(string);
}
options.SkipErrorValue = true;
options.DataTable = dt;
ws.Cells.ExportDataTable(0, 0, ws.Cells.MaxDataRow, ws.Cells.MaxDataColumn, options);
}
}

For Aspose version 21.1.0:

  • The value read is 1.36

For Aspose version 22.12.0:

  • The value read is 1.359999999999

In my business, I CAN NOT use rounding for numbers. I need to get exactly the value in cells without rounding them.

I also try to update to upgrade to the latest stable version of Aspose, but the error still happens.
I tried to change the format cell in the excel file to Text, and the issue is fixed. But my business DOES NOT allow to use other format cells except the format cell number in excel file. So I can’t use this solution.

So I think The Aspose has some issues with the method ExportDataTable() at the latest Version. Can you help me check it? Thanks

@phattran1110,
Would you like to provide template file and runnable console project? we will check it soon.

@John.He ,
Here is the console project and the sample excel file also within it
GetValueExcelFile.zip (137.2 KB)

@phattran1110,
We have printed the data in the datatable, which is indeed 1.36. How did you get 1.359999999999?

@John.He
I run it on version Version=“22.12.0”, and here is the result I got:
image.png (13.1 KB)

And here is the result when I run it on version Version=“21.1.0”:
image.png (12.6 KB)

I just switched the version in this file, restore Nuget and Clean solution before run it again
image.png (52.6 KB)

At the picture of Version=“22.12.0”, You can see the first one is 1.3599999… Please compare it with the excel file. It is the 1.36 needed
image.png (19.6 KB)

@phattran1110,
Would you like to test again with Aspose. Cells 23.3? We can get 1.36. Please check the attachment. result.PNG (47.5 KB)

@John.He
I try to use Aspose.Cells 23.3.0, but the issue still happens

@phattran1110,

I suspect you are not using latest version/fix (Aspose.Cells v23.3). You are still using v22.12.0. I again tested using Aspose.Cells v23.3 and it works fine and I got expected results, see the screenshot attached.
sc_shot1.png (28.2 KB)

Please make sure that you are using Aspose.Cells v23.3 in your project. Even you may print the version number of the APIs (you are using) in code:
Console.WriteLine("Assembly Version Info: " + CellsHelper.GetVersion());

If you still find the issue with latest version, kindly do create a separate console project with Aspose.Cells v23.3, zip the application and post us, we will check it soon.

@phattran1110,

Which .net version are you using? From standard2.0(or later such as net6,net7) the default behavior of net to format double to string changes. For old .net framework, double to string only keeps 15-digits but from standard 2.0 17-digits will be kept. Are you using the same .net version for all versions of our product?

@amjad.sahi @John.He
I’m sure that I use Aspose.Cell version 23.3 and the issue still happens. You can see the picture below
image.png (33.6 KB)

I try many Aspose.Cell versions and figured out that before version 21.12, everything is good. But from version 22.x the issue will happen.

Because my business is not able to upgrade to net6. Currently, I use .Net 3.1
Here is the sample with Aspose.Cell version 23.3
GetValueExcelFile_V233.zip (128.5 KB)

@phattran1110
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-53009

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

Happy to hear that, Thank you!
I just provided more information. I also try with net6 and Aspose.Cell 23.3, and the issue still happen. Here is my console app using net6 and Aspose.Cell 23.3:

GetValueExcelFile_net6_AsposeV233.zip (218.0 KB)

I hope it helps you guys to investigate the problem.

@phattran1110,

Thank you for the additional information and test case. The issue is in process and we will update you when it is fixed.

1 Like

@phattran1110,

This is to inform you that your issue has been resolved. The fix will be included in our upcoming release (Aspose. Cells v23.4) that we plan to release in the first half of April 2023. You will be notified when the next version is released.

1 Like

The issues you have found earlier (filed as CELLSNET-53009) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

1 Like