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

Free Support Forum - aspose.com

Display the message at top and bottom on all pages except the last page

In our application, we’re using ASPOSE words dll verison 9.1 which generate a report in PDF format called Block Schedule (see Attached- C261296_170713_060448.pdf) and working on VS 2008 ASP.NET C#.
This report creates cells and inserts dynamic data per schedule date and merges the all cells to produce final report. Report is not using any template.
Our current requirement is that we need to add “See next page for additional meetings.” message in the top and bottom on all pages if the date goes to 2 or more pages and but message should not be display at the top and bottom of the last page (See Page 6 in C261296_170713_060448.pdf at the bottom of the last page and this message should not be displayed).
To implement this change, we’re unable to find the last page of the report for not to displaying the message at the top and bottom of the page because report data is dynamic and different from each report selection.
We request you to please provide us the technical information about this issue and if you required we’ll provide the working code for your reference. Please let us know if you need any information form us.
Thanks in advance

Hi Gautham,

Thanks for your inquiry. In you case, I suggest you please add the following IF field with PAGE and NUMPAGES fields. This will solve your problem. Please check the attached document for your kind reference.

{ IF { NUMPAGES } = { PAGE } “” “See next page for additional meetings” * MERGEFORMAT }

Please use the following code snippe to insert IF fields with Page and NumPages fields. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a few page breaks (just for testing)
for (int i = 0; i < 5; i++)
// Move the DocumentBuilder cursor into the primary footer.
// We want to insert a field like this:
//{ IF { NUMPAGES } = { PAGE } "" "See next page for additional meetings" \* MERGEFORMAT }
Field field = builder.InsertField(@"IF ");
builder.Write(" = ");
builder.Write(" \"\" \"See next page for additional meetings\" ");
// Finally update the outer field to recalcaluate the final value. Doing this will automatically update
// the inner fields at the same time.
doc.Save(MyDir + "Out.docx");

Hi Manzoor,
Thanks for providing the reference code.
As suggested, we used the insert IF fields with Page and NumPages fields in our code but on generating we still getting message at the top and bottom of the last page.
Please find attached generated report (C261296_240713_050643_LessThan.pdf) and attached our code (“ScheduleCreator.cs”).
Please see the “GenerateReport” method which is used to create report.Following methods for header and footer in the code.
· “SingleRoomHeader” - Header
· “InsertFooterNote” - Footer
We need footer all the pages but not the last page if page count is > 2 .
Please verify “InsertFooterNote” method and let us know your thoughts.
Thanks in advance

Hi Gautham,

Thanks for your inquiry. The InsertFooterNote method is correct. Could you please save your document into Docx file format and share it here for our reference? Please try the InsertFooterNote method in a separte appliction and let us know how it goes on your side.

If you still face problem, please create a simple application (for example a Console Application Project) that helps us reproduce the same problem on our end and attach it here for testing. I will investigate the issue on my side and provide you more information.

Hi Team,
As per your request we created a test project and attached
same and let me know your finding.
Note :: We are able
to save as doc (as per your code) but not able to save as pdf option. Please check the output
files in zip files. Our requirement is save as pdf. Please do the needful and
let me know the additional information / requirements.
Thanks and Regards,

Hi Gautham,

Thanks for sharing the detail. I have tested the scenario while using latest version of Aspose.Words and have not found the shared issue in Pdf file. I would suggest you please upgrade to the latest version (v13.6.0) from here:

Hope this helps you. I have attached the output Pdf file with this post for your kind reference. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Hi Manzoor,
As suggested, it’s working fine as per our requirements.
Presently we are using ASPOSE Words 9.1.0, so we want to upgrade from 9.1.0 to 13.6.0 .
what is the pricing cost for this new version of ASPOSE Words 13.6.0 or it’s free up gradation and please provide the link ?
Please let me know if you required for more information.

Hi Gtheegala,

Thanks for your inquiry. Every Aspose license carries one-year subscription for free upgrades to new versions released during this time. So, after one year, you just will not be able to upgrade Aspose.Words to latest version but license will still work with versions issued within one year after license acquisition.

Moreover, to check an expiration date of your license, please open the license file using notepad. You will see the following tags:


It means that you can freely upgrade to version of Aspose.Words published before 12/18/2013 (No red message, no document truncation).

Regarding pricing cost of Aspose.Words, please post your query at Aspose.Purchase forum here:

My colleagues from sales team will reply you shortly.