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

Free Support Forum - aspose.com

Rounding off value does not occur properly

Hello Team,

A particular cell whose format is provided as percentage holds a value of 0.8765. So after conversion to percentage, the displayed value shows 87.7 % (Which is correct), but when it retrieved through the aspose api, it returns 87.6%. Rounding off value does not occur properly for Percentage Cells in this case. Please help us with this.

Attached the excel sheet for you reference.

The cell name : PremLossRatio_1

Thanks and Regards,



Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells for Java v17.3.5 and it will fix your issue.

We have tested this issue with the following code and attached the output pdf generated by the code as well as screenshot for your reference.

As you can see inside the screenshot, the value i.e 87.7% is correct.

Workbook wb = new Workbook(“GeneratedExcel.xls”);


PdfSaveOptions opts = new PdfSaveOptions();

wb.save(“out.pdf”, opts);

Thanks for your response Shakeel.

Yes correct, it displays 87.7% but while taking value from it through API as shown below. It returns 87.6%.

Workbook workbook=new Workbook(“D:\Document\GeneratedExcel.xls”);
String asposeOutputVal = workbook.getFormattedTextByCustomName(“PremLossRatio_1”);

Output: 87.6%


Thanks for your posting and using Aspose.Cells.

The code you provided is collapsed and is also not runnable. However, we ran our own code and it gave correct results. So it means, you are using some older version and you are not using the latest version we provided to you in the previous post. We have also fixed rounding errors recently.

So, please try the latest version and if your issue still occurs, then please provide us your runnable code, not just code snippet. And if you are facing problem of code collapse, then put the code in some text file and attach it with your post. We will look into your issue and help you asap.

Actually Shakeel, I did use the latest downloaded version - aspose-cells-17.3.0 and got the values differently. Attached the code snippet for your reference. Could you please share me the output of the cell provided - PremLossRatio_1.

Thanks and Regards,

Toney Inbaarasi E R


Thanks for your posting and using Aspose.Cells for Java.

We were not able to execute your code, because Workbook.getFormattedTextByCustomName() method does not exist. I have attached the screenshot that shows this issue.

I regret for the inconvenience caused. Its my bad. Used the version Aspose.Cells for Java v17.3.5. The issue got resolved. Thanks for the support provided.

Thanks and Regards,


Thanks for your feedback and using Aspose.Cells.

It is good to know that you were able to sort out this issue. Let us know if you encounter any other issue, we will be glad to look into it and help you further.