RTF manipulation without a form

General TRichView support forum. Please post your questions here
Post Reply
Marcer
Posts: 31
Joined: Mon Mar 23, 2009 1:54 pm

RTF manipulation without a form

Post by Marcer »

Hi,

I would like to know if there is a way to manipulate RTF text with the TRichView component without having to assign a owner form to the TRichView or TRichViewEdit. For example, inserting one RTF text after an other.

It is very important for me not to have a form or any call that would have something to do with a form.

If it is relevent, the purpose of this is to manipulate RTF text inside a Dll.

Thank you in advance,

Marcer
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use TRVReportHelper.RichView.
Marcer
Posts: 31
Joined: Mon Mar 23, 2009 1:54 pm

Post by Marcer »

The problem is that I use some fonctions that are only defined in TRichViewEdit like InsertText. Do you have other solutions?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

May be I can suggest alternative methods.
What do you want to implement?
Marcer
Posts: 31
Joined: Mon Mar 23, 2009 1:54 pm

Post by Marcer »

Here is some function I need to implement. The principle behind those functions is to use the TRichViewEdit to manipulate RTF but to have only String or Stream as parameters. To achieve that I use TRichViewEdit built in function like:
InsertText
InsertRTFFromStreamEd
SaveRTFToStream
LoadRTFFromStream
SaveHTMLToStream
RVGetTextRange

And those are the function I implement with the help of the TRichViewEdit:
TextToRTF -> Convert simple text to RTF
RTFToText -> Convert RTF to text
MergeRTF -> Take 2 RTF and merge them one after the other
InsertRTF -> Insert RTF text to a defined position
ReplaceRTF -> Use DeleteRTF and InsertRTF
SelectRTF -> Select RTF in between two position but can take a normal text (need to use TextToRTF) or a RTF text (need LoadRTFFromStream)
StringReplaceRTF -> Use RTFToText, DeleteRTF and InsertRTF
DeleteRTF -> Delete text from a normal or RTF text from a position to an other using LoadRTFFromStream, SaveRTFToSream and InsertText
StreamToRTF -> Self explanatory
RTFToHtml -> Self explanatory

I really hope I am clear enough for you to understand what I need.

Thank you for your time,

Marcer
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

One of possible solutions - to create a form with TRichViewEdit but do not show it.

Another solution is trying to avoid editing operations. To insert someting into the specified position, you can use InsertRVFFromStream method. This is the only non-editing method allowing to insert data in the middle. You can convert text or RTF to RVF (using another TRVReportHelper) and then insert RVF.

(additionally, a non-editing method for inserting text in the middle can be found in mail merge demos http://www.trichview.com/forums/viewtopic.php?t=8 , specifically in mailmerge-text3.zip )
Post Reply