Hi,
Currently, I am using Aspose cell Net 20.5 version
The Issue is when I am writing a decimal value getting different value in stringValue and value property
I am writing in cell 0.000032
and getting a string value as 0.000032
and value as 3.2E-05
But the same thing is working with all other decimals.
image.png (205.1 KB)
can any help me with this
@pankajgrwl123,
This is expected behavior. The Cell.Value, Cells.DoubleValue and Cell.FloatValue prperties give value in scientific notations if the value has certain decimal places/parts. MS Excel also converts to scientific notations for bigger decimal value. If you need to get what MS Excel will display for a decimal value, please use Cell.DisplayStringValue attribute.
But this is working for other decimals like
0.285714
0.571429
Only in the case of 0.000032 I am getting scientific notification
@pankajgrwl123,
Yes, this is mostly regarding value having more “0” in decimal part so this will be converted to scientific notations.
@Amjad_Sahi
Why i am getting the string value as 0 when value is 0.016393
@pankajgrwl123,
I used the following sample code and it works as expected, see the comments for output values.
e.g.
Sample code:
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue(0.016393);
Console.WriteLine(worksheet.Cells["A1"].StringValue);//0.016393
Console.WriteLine(worksheet.Cells["A1"].DisplayStringValue);//0.016393
Console.WriteLine(worksheet.Cells["A1"].Value);//0.016393
Console.WriteLine(worksheet.Cells["A1"].DoubleValue);//0.016393
I am using latest version/fix: Aspose.Cells for .NET v21.2.x.
@pankajgrwl123,
It works fine and as expected. Here is our our screenshot which gives correct value.
sc_shot1.png (19.0 KB)
The issue might be due to your own sample code or file. Please create a separate console demo application(runnable) with newer version, zip the project and post us here, we will check it soon.