Page numbers are lost after joining document using .NET

Hello,

Is it possible in Aspose.word using 'AppendDocument' to append a back page to a document and not have it included in the page numbering of the original document?

Regards
Keith

Hi Keith,

Thanks for your query. I have tried to understand your query but unfortunately I have not completely understand your query. It would be great, If you please elaborate your query with more detail.

It seems that you want to insert a document at any location of second document. Please read following documentation link for your kind reference.

http://www.aspose.com/docs/display/wordsnet/How+to++Insert+a+Document+into+another+Document

Hi Tahir

Hope this makes more sense.

I have two documents, the first has multiple pages and is numbered. The second document is a single page, produced seperately to be used as the back page of the first document.

When I append the second document to the first one it continues the page numbering. is there a way to stop this happening?

Thanks
Keith

Hi
Keith,


Thanks for your inquiry. I would like to supplement Tahir’s answer here i.e. page numbers are represented by PAGE field in MS Word documents. If you use PAGE field in header/footer of your first document, the numbering will be continued in the second document unless you explicitly unlink that header/footer for the second document. For example, please try using the following workaround:

Document firstDoc = new Document(@“c:\test\First.docx”);
Document secondDoc = new Document(@“c:\test\Second.docx”);

secondDoc.FirstSection.HeadersFooters.LinkToPrevious(false);

firstDoc.AppendDocument(secondDoc, ImportFormatMode.KeepSourceFormatting);

firstDoc.Save(@“c:\test\out.docx”);

I hope, this will help.

Best Regards,

Many thanks to Tahir and Awais for their replies.

Both these solutions worked.

Regards
Keith

Hi Keith,


Thanks for your feedback. It is perfect that the workarounds resolved your problem. Please let us know any time you have any further queries. We are always glad to help you.

Best Regards,