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

Free Support Forum - aspose.com

Last line of the second paragraph changed after merging aspose documents

Hi,


We have an issue where when we tries to merge two documents using Aspose.Words it will change line alignment. I have attached simple application in this post that can demonstrate issue.

Steps to run it:

1) Open solution in Visual Studio
2) Run Test1() method

After open output.docx file it generates and compare content with original objects.

I also tested this with latest version 15.10 aspose.words and same issue.

Please provide advise on this.

Hi Meet,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you perform the same scenario using MS Word, you will get the same output. Please insert section break (new page) at the end of Object 1.docx and copy contents of Object 2.docx into Object 1.docx. You will get the same output.

Please let us know if you have any more queries.

Hi thanks for investigating this more. I tried same thing on my machine and I am not able to replicate the issue in office word 2010.


This is the full version of office: 14.0.7153.5000 (32-bit)

Hi Meet,

Thanks for your inquiry. We have inserted the contents of Object 2.docx into Object 1.docx using MS Word 2010 and have noticed the same paragraph formatting. We have attached the output document with this post for your kind reference.


Please move the cursor to the end of last paragraph’s text (of Lorem Ipsum.) and insert section break of type “New Page” using MS Word. You will see the same paragraph formatting.

To workaround this issue, please insert empty paragraph at the end of ‘Object 1.docx’ as shown below. Hope this helps you. Please let us know if you have any more queries.

Document mainDocument = new Document(MyDir + “Object 1.docx”);<o:p></o:p>

Document pieceDocument = new Document(MyDir + "Object 2.docx");

mainDocument.LastSection.Body.AppendParagraph("");

var importedSection = ImportSections3(pieceDocument, mainDocument);

mainDocument.Sections.Add(importedSection[0]);

mainDocument.Save(MyDir + "output.docx");