Excel to PDF conversion - Custom number format not displayed correctly in Java

Hi,

I have defined the custom number format “0.00?” for a cell.
I use this format to align numbers in a column at their decimal point.

When I save the workbook as xlsx file, the custom format is displayed as expected (i.e. value 1.5 is formatted as 1.50 with space at third decimal place because of the ? in the custom format pattern).

But when saving the workbook as PDF file, the ? character is printed, i.e. instead of the expected “1.50” it prints “1.50?”

Here is a simple code example to reproduce the behaviour.
I tested with Aspose.Cells for Java Version 21.3

Workbook wb = new Workbook();
Worksheet sheet = wb.getWorksheets().get(0);
Cell cell = sheet.getCells().get(0, 0);
Style style = cell.getStyle();
style.setCustom(“0.00?”);
cell.setStyle(style);
Double value = 1.5;
cell.setValue(value);
wb.save(“C:/Temp/test.xlsx”);
wb.save(“C:/Temp/test.pdf”);

Thanks in advance.

@safir,

Please notice, we were able to reproduce the issue as you mentioned. We found custom formatting is not working as expected in the output PDF file format. We have logged a ticket with an id “CELLSJAVA-43419” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@safir,
Please try our latest version/fix Aspose.Cells for Java v21.3.3:

aspose-cells-21.3.3-java.zip (7.2 MB)

Your issue should be fixed in it.

Let us know your feedback.

Hi,
with the version 21.3.3 the numbers are now displayed as expected in PDF output.
I can confirm that the issue is solved.
Thanks for the fast support and for providing the fixed version!

@safir,

Thanks for your feedback.

It is nice to know that your issue is resolved by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-43419) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi