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

Free Support Forum - aspose.com

Get rounding data when extracting formatted numbers from Spreadsheet in Java

I am using Aspose.Cells for java to extract formatted data from excel spreadsheets. I have recently run into an issue with a number rounding problem when extracting formatted data.

I have a cell with the number 5.45% it is formatted in excel as a percentage and 1 decimal place which displays in excel as 5.5% however when I use Aspose.Cells to extract the data I get 5.4%.

I have attached the spreadsheet for your reference. The cell of interest is K7.


Thanks for you help. Note I am working with the latest version of Aspose.cells for Java which I downloaded today.


Jim Spurrell

Hi Jim,

Thanks for the template file with details.

We tested and found the problem you mentioned.

We will figure out the issue soon.

Thank you.

Hi Jim,

Please try this fix.

Thanks for the quick fix. I have tried it and it works.


Jim

After doing some additional testing we still seem to have the rounding problem when we have numbers with more then decimal places and then formatted down to 2. I have attached an example spreadsheet take a look at cell 7B for an example of the problem.


Thanks,

Jim

I'm having an issue where my percentage is say an integer which is 60, but when I format the cell as percentage I get 6000%.... so it's always adding 2 zeros at the end of the percentage. I'm using style.number = 9.

I've tried several ways to get the percentage to display correctly but to no avail. How can I fix this? It should be 60%

Hi,

Thank you for considering Aspose.

Well, this is exactly the functionality of MS Excel percentage display format. In MS Excel, if you provide a value 60 to a Cell and change its display format to percentage, it will make it 6000%.

Now the solution you can use is to assign your cell a value 0.6( which is Cell.Vlaue/100), this will be equivalent to 60% in Display format for Percentage (Style.Number = 9).

Hope this will help.


Thank You & Best Regards,