Print issue while merging documents

Hi,

I am merging multiple documents using below formula. i have to kept page numbering different for each merged document.

Document docfinal = new Document(“Final.doc”);
Document doc_current = new Document(“Final1.doc”);
doc_current.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;
doc_current.FirstSection.PageSetup.RestartPageNumbering = true;
doc_current.FirstSection.HeadersFooters.LinkToPrevious(false);
docall_final.AppendDocument(doc_current, ImportFormatMode.KeepDifferentStyles);
docall_final.Save(“Final.doc”);

Now when i use print option it is not printing the page i want. Like i want to print page no. 4.
It is print some another page.
(for ex - my merged document contains 26 pages. When i tried to print page number 4, it prints page number 21 to 24.)
Where is the issue occuring?
Thanks

Hi Shivam,

Thanks for your inquiry. Please call Document.UpdatePageLayout method before printing the document. This method formats a document into pages and updates the page number related fields in the document such as PAGE, PAGES, PAGEREF and REF. Hope this helps you.

If you still face problem, please share your input Word documents here for testing. We will investigate the issue on our side and provide you more information.

Hi ,

I am not printing from code. I am printing from MS word. In word it is giving problem.

Thanks
Hi Shivam,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word documents.
  • Please attach the output Word file that shows the undesired behavior.
  • Please share MS Word version that you are using.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.

Hi,


I am sending you document and code. In this code i am merging three documents and after that when i open the document in MS word 2016, the printing behavior is not good.

I select custom page to print. ( ex- 4-6). It is printing other page.

Thanks

Hi Shivam,

Thanks for your inquiry. This issue seems not to be related to Aspose.Words. Please note that Aspose.Words mimics the same behavior as MS Word does. If you merge the documents and print the final document using MS Word 2016, you will get the same output.

Hi,


Okay, Thanks for your reply.Then i will set page number from starting.

Thanks