Merge RTF

How to merge RTF files in C#

GroupDocs.Merger allows developers to merge RTF files when it’s needed to organize multiple RTF files into single document or send fewer attachments etc. And you can do this without¬†any third-party software or manual work involved. With GroupDocs.Merger it is possible to combine RTF documents of any size and structure - all text, images, tables, graphs, forms and other content will be preserved.

The following example demonstrates how to merge RTF files with several lines of C# code:

  • Create an instance of Merger class and pass source RTF file path as a constructor parameter. You may specify absolute or relative file path as per your requirements.
  • Add another RTF file to merge with Join method. Repeat this step for other RTF documents you want to merge.
  • Call Merger class Save method and specify the filename for the merged RTF file as parameter.
// Load the source RTF file
using (Merger merger = new Merger(@"c:\sample1.rtf"))
{
    // Add another RTF file to merge
    merger.Join(@"c:\sample2.rtf");
    // Merge RTF files ans save result
    merger.Save(@"c:\merged.rtf");
}

About RTF File Format

Introduced and documented by Microsoft, the Rich Text Format (RTF) represents a method of encoding formatted text and graphics for use within applications. The format facilitates cross-platform document exchange with other Microsoft Products, thus serving the purpose of interoperability. This capability makes it a standard of data transfer between word processing software and, hence, contents can be transferred from one operating system to another without losing document formatting.

Code Examples

Please find more use-cases and complete C# sources of our backend and frontend examples and try them for free!

Merge RTF Live Demo

GroupDocs.Merger for .NET provides an online RTF Merger App, which allows you to try it for free and check its quality and accuracy.

“Merge RTF”