FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Merge rtf
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Merge rtf
Posted: Wed Jan 27, 2016 09:16 AM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Merge rtf
Posted: Wed Jan 27, 2016 10:56 AM
Marco,

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

http://stackoverflow.com/questions/628553/merge-rtf-files

Code (fw): Select all Collapse
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
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Merge rtf
Posted: Wed Jan 27, 2016 11:09 AM

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
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Merge rtf
Posted: Thu Jan 28, 2016 06:53 AM

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 ?

Continue the discussion