Footer on last page only

Hi

I’m using a Word document as a template for generating PDF documents.

I was looking at this post:

It seems to address my problem in some extent but my problem is that I’m using a Word document as template for the PDF generation. So I have a footer which contains a table with some placeholders. How can I use the content in the footer with the
{ IF “{ PAGE }” = “{ NUMPAGES }” “true part” “false part” }

It seems to me that “true / false” part only takes in a string. Not sure how that works with the current DOM of the Word document.

Regards
Oskar

@oskarb4b7c,

Thanks for your inquiry. You can use the same approach to insert the IF field in the document’s footer. If you still face problem, please ZIP and attach your input Word document here for our reference. We will then provide you more information about your query along with code.

I think my problem is limited to that I have a merged Word document so the page numbering won’t work in either case.
As in this question:

@oskarb4b7c,

Thanks for your inquiry.

Please note that Aspose.Words mimics the behavior of MS Word. In your case, we suggest you please replace NUMPAGES with SECTIONPAGES field in your document. Hope this helps you.

Thanks for that response Tahir.
My problem is though that the [PAGE] counter counts the page from the start of the document and not within the section.
So the check goes:
{IF “3” = “4” “Yes” “No”}
{IF “4” = “4” “Yes” “No”}
{IF “5” = “4” “Yes” “No”}

@oskarb4b7c,

Thanks for your inquiry. You can set the page start number for a section using PageSetup.PageStartingNumber property. Please set the value of PageSetup.RestartPageNumbering property as true.

If you still face problem, please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

Looks like I got it to work now. Thanks!

@oskarb4b7c,

It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.