Different footer on last page

Hi,
Many thanks for your assistance, our data is now showing up correctly when placed in the Header & Footer.
I have however stumbled on another item, which hopefully you can assist with.
I would like to know if it is possible for all pages except the last page to show text ‘Continued…’ in the footer, but on the last footer I would like a total of our complete invoice.
Please let me know if you require a version of our current invoice.
Cheers

Hi

Thanks for your inquiry. There is no direct way to define header/footer of the last page in MS Word documents. However, there are two workarounds of this issue.

  1. Use separate section of the last page. In this case, you can specify header/footer for the each section.
  2. Use IF field conditions to display different text on the last page. for example see the following code. But note, this will not work in PDF yet.
// Create Document and DocuemntBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Build document.
// Just for testing add few pages.
for (int i = 0; i <10; i++)
    builder.InsertBreak(BreakType.PageBreak);
// Move DocumentBuilder cursor to the primary footer.
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
// There is no direct way to have different headers/footers for the last page.
// However, we can achieve this using IF field.
// In our case, IF field code will look like the following:
// { IF "{PAGE}" = "{NUMPAGES}" "This is last page" "This is primary footer" }
// Insert the first part of the IF field
FieldStart start = builder.InsertField("IF \"", null);
// Move DocumentBuilder cursor to the next run after field start.
builder.MoveTo(start.NextSibling.NextSibling);
// Insert PAGE field.
builder.InsertField("PAGE", null);
// Insert operator.
builder.Write("\" = \"");
// Insert NUMPAGES field.
builder.InsertField("NUMPAGES", null);
// Insert true/false values.
builder.Write("\" \"This is last page\" \"This is primary footer\"");
// Save output document.
doc.Save(@"Test001\out.doc");

Best regards.

Thanks Alexey.

I have just sent you off an e-mail regarding an issue with the If Statements.

Hi

Thank you for additional information. In your document, you insert PAGE and NUMPAGES fields as text, and not as fields. Please see my code example to learn how to insert nested fields.
Best regards.

Thanks Alexey. This has been tested and is now working fine.
One more question with regards to the issue converting it to PDF (footers is not being picked up correctly). Is their any schedule for this fix to be released?

Hi

Thanks for your inquiry. Currently, it is difficult to promise you something regarding this problem. I linked your request to the appropriate issue. We will let you know one the issue is resolved.
Best regards.

The issues you have found earlier (filed as 11386) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(18)