GroupDocs.Merger does not remove page break for merged documents(docx). Does it have any options to turn the page break off?
To merge Word documents without introducing page breaks, you can utilize the WordJoinOptions
class provided by the GroupDocs.Merger library. Specifically, you should set the Mode
property of WordJoinOptions
to WordJoinMode.Continuous
. This setting allows the documents to be merged continuously without starting a new page for each document.
Here’s a sample implementation in C#:
using GroupDocs.Merger.Domain.Options;
using System;
using System.IO;
namespace GroupDocs.Merger.Examples.CSharp.BasicUsage
{
internal static class MergeWordDocumentsWithoutStartingFromNewPage
{
public static void Run()
{
Console.WriteLine("=======================================================================");
Console.WriteLine("Example Basic Usage: MergeWordDocumentsWithoutStartingFromNewPage");
Console.WriteLine();
string outputFolder = "YourOutputDirectoryPath"; // Specify your output directory
string outputFile = Path.Combine(outputFolder, "merged.doc");
// Load the source DOC file
using (var merger = new GroupDocs.Merger.Merger("YourFirstDocumentPath.doc"))
{
// Define Word join options
WordJoinOptions joinOptions = new WordJoinOptions
{
Mode = WordJoinMode.Continuous // Set to Continuous to avoid page breaks
};
// Add another DOC file to merge
merger.Join("YourSecondDocumentPath.doc", joinOptions);
// Merge DOC files and save result
merger.Save(outputFile);
}
Console.WriteLine("DOC files merge completed successfully. Check output in {0}", outputFolder);
}
}
}
Make sure to replace "YourOutputDirectoryPath"
, "YourFirstDocumentPath.doc"
, and "YourSecondDocumentPath.doc"
with the actual paths of your output directory and documents.
This approach should effectively prevent any unwanted page breaks when merging your documents. For more details, you can refer to the official documentation on merging Word documents here.
Sources:
[1]: Merge Word Documents Without Starting From New Page (C#)
Thank you! it worked perfectly!
Hi, I just realized I need to remove section break as well. Is there any option to do that?
We are investigating this scenario. Your investigation ticket ID is MERGERNET-1824. You’ll be notified in case of any update.
The issues you have found earlier (filed as MERGERNET-1824) have been fixed in this update. This message was posted using Bugs notification tool by atir.tahir