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

Free Support Forum - aspose.com

Cell Return with decimal value in Latest version

Hi,

I set value to the cell as shown below
cells[0, 0].Value = 111111;

But while get value from cell
cells[0, 0].Value

then it return as 111111.0

Problem occurs after this version 8.1.0.0
But in Version 7.1.2.0 it return value(111111) as correctly.

Please suggest

Thanks

Hi,


Please try our latest version/fix: Aspose.Cells for .NET (Latest Version):

Aspose.Cells for .NET (Latest Version)

I have tested your scenario/ case a bit using the following sample code with v17.4.1, it works fine and as expected:
e.g
Sample code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells[0, 0].Value = 111111;
Console.WriteLine(worksheet.Cells[0, 0].Value);//111111

If you still find any issue with v17.4.1, kindly paste your sample code (runnable) with template file (if any) to reproduce the issue, we will check it soon.

Thank you.

Hi Team


Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells[0, 0].Value = 111111;
Console.WriteLine(worksheet.Cells[0, 0].Value);//111111

the above code will also show the decimal point value (111111.0) using aspose Cell 17.4.1.0

Hi,


Thanks for the sample project and screenshot.

We got your point now. Yes, for older versions, when a user input integer value, we keep it as integer value as int for the cell. But in newer versions, we did make this change some time ago. In
the new versions, we only keep double object for cell’s numeric values. So, if you do not want to show the addition, i.e., “.0”, you can check and force it to int by yourself easily. See the line of code for your reference:
e.g
Sample code:

if(value == (int)value)…

Thank you.