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

Free Support Forum - aspose.com

Problem with save to pdf chinese font on header and footer

I open a tempate .xlsx file with aspose cell, and then add data from database to the excel file, and save to pdf format. the chinese character in the header and footer is not display correctly.

Is it a bugs?

Hi Lee,


Thank you for considering Aspose, and welcome to Aspose.Cells support forum.

We are not sure if your presented scenario is a bug on the part of Aspose.Cells API or just incorrect settings. We will require your template file along with source code snippets (most preferably a standalone run-able application) if you are inserting the headers and footers programmatically.

We would request you to please give the latest version of Aspose.Cells for Java 8.0.0 a try on your end. In case the problem persists, please provide the sample spreadsheet and application to replicate the issue on our end. If possible, please also provide the snapshots of the issue. This will help us evaluate the scenario more precisely.

Hi Babar,

Thank you for your reply.

I have create a Sample project with Aspose.Cells 8.0.0. to show the problem.

Please find the project on the attchment.

The attchment also include the template .xlsx file for testing.

Aspose.Cells work perfectly except the chinese character on the print header and footer.

Please test it with my attachment. and provide solution if any.

Hi Lee,


Thank you for providing the required information to evaluate the presented scenario.

I am afraid, the problem didn’t replicate on my end while using the latest version of Aspose.Cells for Java 8.0.0. Please check the attached resultant PDF with correct header text. We suspect the problem could be due to the missing fonts on your machine, and you can avoid the said problem by first checking the availability of required font (ArialUnicodeMS, Bold) and then explicitly setting the path to the font directory using CellsHelper.setFontDir method as show below. Please do change the path according to your local installation.

Java

CellsHelper.setFontDir(“C:/Windows/Fonts”);
Workbook book = new Workbook(myDir + “advancedReport.xlsx”);
book.save(myDir + “output.pdf”, SaveFormat.PDF);

Hi Babar,

After install the fonts, the problem is solved.

Thank you for your help.

Hi Lee,


Thank you for the confirmation. It’s good to know that you are up and running again. Please feel free to write back in case you face any difficulty or have more questions for us.