Page 1 of 1
RTF manipulation without a form
Posted: Thu Sep 09, 2010 7:34 pm
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
Posted: Fri Sep 10, 2010 3:58 pm
by Sergey Tkachenko
You can use TRVReportHelper.RichView.
Posted: Fri Oct 01, 2010 3:30 pm
by Marcer
The problem is that I use some fonctions that are only defined in TRichViewEdit like InsertText. Do you have other solutions?
Posted: Fri Oct 01, 2010 5:21 pm
by Sergey Tkachenko
May be I can suggest alternative methods.
What do you want to implement?
Posted: Fri Oct 08, 2010 12:26 pm
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
Posted: Fri Oct 08, 2010 5:35 pm
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 )