Merge rtf

Merge rtf

Postby Marco Turco » Wed Jan 27, 2016 9: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Merge rtf

Postby Antonio Linares » 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: Select all  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42076
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Merge rtf

Postby Marco Turco » 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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Merge rtf

Postby Jack » Thu Jan 28, 2016 6: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 ?
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests