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

Free Support Forum - aspose.com

Can I add footer (only) at the last page of document


I am using Aaspose Word to generate doc. here is a Scenario, please let me know if can it can be achieved using your tool

1)I want to display some image or text at the last page of the document

2)This image/text should be bottom aline

3)I don’t want to use header/footer feature of word as this will make my text appear in the footer of every page

4)Page contents are generating dynamically, so how many pages a document will have can not determined.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks in advance

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think that you can try using floating shapes. For example see the following code:

//Create document

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Generate some content

for (int i = 0; i < 100; i++)


builder.Writeln("this is text of document");


//Move DocumentBuilder cursor to the end of document


//Get page setup of last section of document

PageSetup ps = doc.LastSection.PageSetup;

//Create textbox

Shape textBox = new Shape(doc, ShapeType.TextBox);

Paragraph par = new Paragraph(doc);

par.ParagraphFormat.Alignment = ParagraphAlignment.Center;

Run run = new Run(doc, "this is text at bottom");




//Configure textBox

textBox.Width = ps.PageWidth-ps.LeftMargin-ps.RightMargin;

textBox.Height = 50;

//Set position of shape

textBox.RelativeVerticalPosition = RelativeVerticalPosition.Page;

textBox.VerticalAlignment = VerticalAlignment.Bottom;

//Disable borders

textBox.Stroked = false;

//Save document


The same technique you can use for inserting images.

Hope this helps.

Best regards.