Page breaks inbetween merged documents - how to remove page breaking? in c#

Hi

Getting Page breaks in between merged documents - how to remove page breaking?
We have merged the Documents using below code

Found the below issues

  1. Line break was deleted Line break was deleted Original.PNG (7.2 KB)
    Line break was deleted.PNG (13.9 KB)

  2. Style of Paragraph was changed Original Style of Paragraph was changed.PNG (12.7 KB)
    Style of Paragraph was changed.PNG (13.9 KB)

    Aspose.Words.Document TargetDoc = new Aspose.Words.Document();
    string[] FilePaths = new string[2];
    FilePaths.add(@"D:\Source 1.doc");
    FilePaths.add(@"D:\Source 2.doc");
    FilePaths.add(@"D:\Source 3.doc");
    foreach (var FilePath in FilePaths)
    {
         Aspose.Words.Document DocItem= new Aspose.Words.Document(FilePath);
         case 1
         //TargetDoc.AppendDocument(DocItem, ImportFormatMode.KeepDifferentStyles);
    
         case 2
         TargetDoc.RemoveAllChildren();
         DocItem.FirstSection.HeadersFooters.LinkToPrevious(false);
         Aspose.Words.Run pageBreakRun = new Aspose.Words.Run(DocItem, ControlChar.PageBreak);
         DocItem.FirstSection.Body.LastParagraph.AppendChild(pageBreakRun);
         TargetDoc.AppendDocument(DocItem, ImportFormatMode.KeepSourceFormatting);<a class="attachment" href="/uploads/default/28246">Word Merge issue.zip</a> (23.3 KB)
    
    }
    TargetDoc.Save(@"D://Case1Result.doc");
    

Find the reference Documents for the above code.Word Merge issue.zip (23.3 KB)

Find the expected file in above attachment.

Please provide the solution

@kranthireddyr

In your case, we suggest you please remove the empty lines and page break from the end of document and then merged them.

Moreover, the shared input documents are different from the shared images. Please share the input, problematic output and expected output documents here for testing. We will then provide you more information about your query.