Getting Text from RVF loaded non-visually

General TRichView support forum. Please post your questions here
Post Reply
kabal
Posts: 6
Joined: Tue Sep 02, 2008 12:05 pm

Getting Text from RVF loaded non-visually

Post by kabal »

In our app there is a section where users can define there own "templates" for emails that are sent throughout the system. Users can add predefined tags to the document, and then the RVF is saved to a stream which is stored in a blob in the db.

eg
//
This is a template and <% THIS.IS.A.TAG %> to be replaced with other data.
//

Basically what I want to be able to do, is on our appserver, possibly in a separate thread, it to load the blob to stream, and then call the TRichView.LoadRVFFromStream, call TRichView.SelectAll, and then TRichView.GetSelText and then parse that text with regular expressions, so I can get the exact tags out, get the data for those tags, and then do a find replace in TRichView and replace the tags with the correct data, and then possibly export to html.

However, if I call TRichView.SelectAll without calling TRichView.Format, I get an index out of bounds error, and if I call TRichView.Format, I get the no parent window error.

How do I go about getting the text when the Trichview is not on a form?

Also, when will the find functionality support RegEx?

Thanks in advance
Shaine
kabal
Posts: 6
Joined: Tue Sep 02, 2008 12:05 pm

Post by kabal »

I got this working using a dummy form that I create but never show.

still interested to know about search with regex though :)
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Formatting is the slowest operation. If you do not need to display document, try avoiding it. Yes, working with selection requires formatted document. But is selection really needed for this task?
You can analyze document item by item and replace fields.
See here for demos: http://www.trichview.com/forums/viewtopic.php?t=8
Post Reply