Merge rtf

Post Reply
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Merge rtf

Post by Marco Turco »

Hi all,
is there a function, lib or code to merge several RTFs into a single RTF file ?
Thank you.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Merge rtf

Post by Antonio Linares »

Marco,

You could use two richedit controls. I got the idea from here:

http://stackoverflow.com/questions/6285 ... -rtf-files

Code: Select all

RichTextBox rtbTemp = new RichTextBox();
RichTextBox rtbMerged = new RichTextBox();

string Merge(string s1, string s2)
{
    rtbTemp.Rtf = s1;
    rtbTemp.SelectAll();
    rtbTemp.Cut();
    rtbMerged.Paste();

    rtbMerged.AppendText(Environment.NewLine);
    rtbMerged.AppendText(Environment.NewLine);

    rtbTemp.Rtf = s2;
    rtbTemp.SelectAll();
    rtbTemp.Cut();
    rtbMerged.Paste();

    return rtbMerged.Rtf;
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Re: Merge rtf

Post by Marco Turco »

Interesting, I will try thank you,
anyway I think this way the RTF code will be converted into a WordPad standard so many advanced RTF information (using Word or OpenOffice) would be lost.
Best Regards,

Marco Turco
SOFTWARE XP LLP
Jack
Posts: 249
Joined: Wed Jul 11, 2007 11:06 am

Re: Merge rtf

Post by Jack »

Hi ,
I have an idea.

Open the first RTF file with word and insert the other RTF at the end of the first document.

At the end, you save the file .

Why not ?
Post Reply