concatenate the RTF text

I am stroring the RTF text in the long type field of oracle

rs!textrtf= richtextbox1.textRTF

then restoring


Now I want to concatenate no of RTF texts from database and show them in a rich textbox  as a single document without loosing formating

can you please help me ?

Rahul BagalFounder of IncubXpertsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rahul BagalFounder of IncubXpertsAuthor Commented:
Also How can I Insert this in the active document of Word to print ?
An easy way is to have a RichTextBox object in your program ( in a temp form or as an object).
say, you have the rtf in a string as rtf1
you need to concat rtf2 to rtf1

Richtextbox1.selrtf = rtf1
richtextbo1.selrtf = richtextbo1.selrtf + rtf2

Now you can take the rtf text from the Richtextbox as richtextbox1.selrtf and store it in the database.

Another options

You need to remove the ending tag of a Rtf content \para} and the starting tag of the second text,concat them and save.
Rahul BagalFounder of IncubXpertsAuthor Commented:
this Does not work . I write a test  program

Dim rtf1, rtf2 As String

Private Sub Command1_Click()
rtf1 = RichTextBox1.TextRTF
rtf2 = RichTextBox2.TextRTF
RichTextBox3.SelRTF = rtf1
RichTextBox3.SelRTF = RichTextBox3.SelRTF + rtf2
End Sub


Can you pleas tell me which is  starting & Ending  tag of the rtf text and which I should concatenate
This is sample RTF..

{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss MS Sans Serif;}}
\deflang1033\pard\plain\f2\fs17 SAMPLE RTF TEXT
\par }
Try out this code ..
take 4 Rich Text Boxes RTB1
, RTmp - for Temp storage of RTF Text

Dim x As Long
Private Sub Command1_Click()
rtmp.Text = RTB1.TextRTF
x = rtmp.Find("\par }") ' clear ending tag

If x = -1 Then
    '  MsgBox "No End found"
    rtmp.SelText = ""
End If
rtmp.Text = rtmp.Text & rtb2.TextRTF
x = rtmp.Find("{\rtf1\ansi\deff0\deftab720", 35) ' This should not care starting tag

If x = -1 Then
    '  MsgBox "No Start found"
    rtmp.SelText = ""
End If
rtb3.TextRTF = rtmp.Text

End Sub

This thing should work for you

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rahul BagalFounder of IncubXpertsAuthor Commented:
Thanks Asmita
This really worked out
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.