Merge two RTF files and create new sinlge RTF document. Output file will be overwritten.

Namespace:  SautinSoft
Assembly:  SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 4.6.10.19

Syntax

      
 C#  Visual Basic 
public int MergeRtfFile(
	string rtfFilePath1,
	string rtfFilePath2,
	string singleMergedRtf
)
Public Function MergeRtfFile ( _
	rtfFilePath1 As String, _
	rtfFilePath2 As String, _
	singleMergedRtf As String _
) As Integer

Parameters

rtfFilePath1
String
Path to 1st RTF document
rtfFilePath2
String
Path to 2nd RTF document
singleMergedRtf
String
Local path to save output RTF

Return Value

0 - merged successfully
1 - can't open 1st RTF document
2 - can't open 2nd RTF document
3 - merging failed
4 - can't create output file, check the output path

Remarks

A merged RTF document will contain 1st RTF document and next 2nd RTF document by order.



Examples

CopyHow to merge two RTF files in C#
using System;
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {

            //Merge two RTF files
            //If you need more information about HTML-to-RTF Pro DLL .Net email us at:
            //support[at]sautinsoft.com

            SautinSoft.HtmlToRtf objH = new SautinSoft.HtmlToRtf();
            //objH.Serial = "XXXXXXXXXXXXXXX";

            //Merge two RTF files and create new sinlge RTF document
            int ret = objH.MergeRtfFile(@"d:\report1.rtf", @"d:\report2.rtf", @"d:\single.rtf");
            /// <returns>
            /// 0 - merged successfully<br />
            /// 1 - can't open 1st RTF document<br />        
            /// 2 - can't open 2nd RTF document<br />        
            /// 3 - merging failed<br />
            /// 4 - can't create output file, check the output path<br />
            /// </returns>

            if(ret==0 )
            {
                System.Diagnostics.Process.Start(@"d:\single.rtf");
            }
        }
    }
}
CopyHow to merge two RTF files in VB.Net
Imports System
Imports System.IO
Imports System.Text

Module Module1
    Sub Main()
        'Merge two RTF files
        'If you need more information about HTML-to-RTF Pro DLL .Net email us at:
        'support[at]sautinsoft.com


        Dim objH As New SautinSoft.HtmlToRtf
        'objH.Serial = "XXXXXXXXXXXXXXX";


        'Merge two RTF files and create new sinlge RTF document
        Dim ret As Integer = objH.MergeRtfFile("d:\report1.rtf", "d:\report2.rtf", "d:\single.rtf")
        ''' <returns>
        ''' 0 - merged successfully<br />
        ''' 1 - can't open 1st RTF document<br />        
        ''' 2 - can't open 2nd RTF document<br />        
        ''' 3 - merging failed<br />
        ''' 4 - can't create output file, check the output path<br />
        ''' </returns>


        If ret = 0 Then
            System.Diagnostics.Process.Start("d:\single.rtf")
        End If
    End Sub
End Module

See Also