Cannot add footer to MS Office 2007 document

Hi,

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.

Thanks
								</div>
								</div>

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,