Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Apr 12, 2022 8:48 pm

I am using spire.xls in c# and trying to get the percentage type values in the excel sheet.
I read up online and found this code should work:

sheet.Range["B12"].Text = "0.00%";
sheet.Range["C12"].NumberValue = 1234.5678;
sheet.Range["C12"].NumberFormat = "0.00%";

But so far it has not worked.

The version we are using for SPIRE - 10.1.0 via nugetpackage


I have attached the images with this.
One image shows even after using the demo or the code from the forum still the formatting type is General and not the Percentage.

Second image shows what we actually are trying to achieve.

Pls advice
Attachments
Screenshot 2022-04-12 154608.png
This is what we are trying to achieve.
Screenshot 2022-04-12 154608.png (106.94 KiB) Viewed 571 times
Screenshot 2022-04-12 154431.png
The one with the error.
Screenshot 2022-04-12 154431.png (62.02 KiB) Viewed 571 times

ankitch656
 
Posts: 2
Joined: Tue Apr 12, 2022 8:41 pm

Wed Apr 13, 2022 3:58 am

Hello,

Thank you for your inquiry.
I tested your code with the latest version of Spire.XLS(Spire.XLS Pack(Hotfix) Version:12.3.8) and did not reproduce your problem, I have attached a screenshot of my test result file. Please test it again with the latest version first. If the issue still exists after testing, please provide the following information. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.
1) Your input excel file.
2) Your complete test code.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
4) Your application type, such as Console app (. Net Framework 4.5).

Sincerely,
Annika
E-iceblue support team
Attachments
screenshot.png
screenshot.png (17.98 KiB) Viewed 560 times
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS

cron