Free Support Forum -

Page Numbering in Header/Footer when converting Excel to PDF


I need to convert Aspose Cells workbooks based on Excel template files into PDF where each Excel template may contain a different header and footer, sometimes including page numbering. Reading the template and saving it back again as an .xls works fine - header+footers are correct and the page numbering as well.

When converting to PDF, the original header from the Excel template is then visible only on the first page, and the page numbers are displayed as placeholders $p / $P.

Since the conversion is done the same way for all kind of workbooks/templates, I cannot just redefine and setup a standard header/footer for the PDFs. So what is the recommended way to get the headers+footers within the PDF look exactly the same as in the original Excel template / Aspose Cells workbook?

All code and needed files are attached. (I wasn’t able to test it with Aspose PDF v2.5 due to the nullpointer bug).

Thanks a lot for your help!

Hello Lennart,

I have tested the scenario with Aspose.Pdf for Java 2.5.0 and I am unable to notice the problems i.e. The page number information and Header/Footers are properly being displayed in the resultant PDF document. For your reference, I have also attached the resultant file in attachment, please take a look.

I am afraid we might not be able to correct the issue in previous versions. So you need to use the latest version.

Regarding the other issue nullpointer bug we are looking into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.