Click or drag to resize

HtmlToRtfMergeOptions Class

Specifies options to merge RTF documents.
Inheritance Hierarchy
SystemObject
  SautinSoftHtmlToRtfMergeOptions

Namespace: SautinSoft
Assembly: SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 2023.12.6
Syntax
public class MergeOptions

The HtmlToRtfMergeOptions type exposes the following members.

Constructors
 NameDescription
Public methodHtmlToRtfMergeOptionsInitializes a new instance of the HtmlToRtfMergeOptions class
Top
Properties
 NameDescription
Public propertyCode examplePageBreakBetweenDocuments Gets and sets the value indicating to insert a page break between merged RTF documents. Default value: false.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Example
Merge two RTF documents in memory using C#
using System;
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {
            // Get your free 30-day key here:   
            // https://sautinsoft.com/start-for-free/

            // Merge two RTF documents in memory.
            // If you need more information about "HTML to RTF .Net" email us at:
            // support@sautinsoft.com.
            MergeRtfsInMemory();
        }

        public static void MergeRtfsInMemory()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            // Now we've both RTF documents stored in memory in String objects.
            string rtfString1 = File.ReadAllText(@"..\..\..\footer.rtf");
            string rtfString2 = File.ReadAllText(@"..\..\..\footer.rtf");

            // Let's divide RTF documents using page break.
            h.MergeSetup.PageBreakBetweenDocuments = true;

            string rtfSingle = h.MergeRtfString(rtfString1, rtfString2);

            // Save 'rtfSingle' to a file for demonstration purposes and show it.
            if (!String.IsNullOrEmpty(rtfSingle))
            {
                string singleRtfFile = "Single.rtf";
                File.WriteAllText(singleRtfFile, rtfSingle);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(singleRtfFile) { UseShellExecute = true });
            }
        }
    }
}
Merge two RTF documents in memory using VB.Net
Imports System
Imports System.IO

Namespace Sample
    Friend Class Test

        Shared Sub Main(ByVal args() As String)
            ' Get your free 30-day key here:   
            ' https://sautinsoft.com/start-for-free/

            ' Merge two RTF documents in memory.
            ' If you need more information about "HTML to RTF .Net" email us at:
            ' support@sautinsoft.com.
            MergeRtfsInMemory()
        End Sub

        Public Shared Sub MergeRtfsInMemory()
            Dim h As New SautinSoft.HtmlToRtf()

            ' Now we've both RTF documents stored in memory in String objects.
            Dim rtfString1 As String = File.ReadAllText("..\..\..\footer.rtf")
            Dim rtfString2 As String = File.ReadAllText("..\..\..\footer.rtf")

            ' Let's divide RTF documents using page break.
            h.MergeSetup.PageBreakBetweenDocuments = True

            Dim rtfSingle As String = h.MergeRtfString(rtfString1, rtfString2)

            ' Save 'rtfSingle' to a file for demonstration purposes and show it.
            If Not String.IsNullOrEmpty(rtfSingle) Then
                Dim singleRtfFile As String = "Single.rtf"
                File.WriteAllText(singleRtfFile, rtfSingle)
                System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(singleRtfFile) With {.UseShellExecute = True})
            End If
        End Sub
    End Class
End Namespace
See Also