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

Free Support Forum - aspose.com

Cannot add footer to MS Office 2007 document


We use Aspose.Total for Java and have the follow issue:
1. Try to add footer to MS Office document, but there is NPE error

Attach file for reproducing the problem and the error.


Hi Ginka,

Thanks for your inquiry. Could you please also share your source code causing this problem here for testing? I will investigate the issue on my side and provide you more information.

Best regards,

Hi Awais,

I apply the source code in attached file “Aspose Add Footer.txt”.

Best Regards,
Ginka Kyoseva

Hi Ginka,

Thanks for your inquiry.

Please note that there are three Sections in your Word document. The statement builder.moveToDocumentEnd(); in addWordFooterWithTabStop method moves the cursor to the third Section of your document. When the control reaches inside the body of copyHeadersFootersFromPreviousSection method, the primary footers of second and third Sections would have already been removed and the statement Section previousSection = (Section) section.getPreviousSibling(); in copyHeadersFootersFromPreviousSection method returns second Section. In your case, you would be needing a reference to first Section; please modify this statement as follows:

Section previousSection = (Section)section.getPreviousSibling().getPreviousSibling();

I hope, this helps.

Best regards,