TDBRichEdit and replacing tags with text on save/load

General TRichView support forum. Please post your questions here
Post Reply
Ar4i
Posts: 30
Joined: Tue Apr 24, 2007 7:03 am

TDBRichEdit and replacing tags with text on save/load

Post by Ar4i »

I have to make a template editor and I need to replace some text values with tags on load and then back to text on save (those text values represent certain queries and field in queries as well as some other things like cycles and formulaes that are not very user friendly).

My question is what are the most suitable TDBRichView events that can be used to modify contents of the RichView on LOAD and SAVE (especially from/to DB because I use TDBRichView).
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

OnLoadDocument is called after the document is loaded from field, but before it is displayed (i.e. before DBRichView calls Format).
In this event you can do mail merging.

DBRichView cannot save documents in fields.
Ar4i
Posts: 30
Joined: Tue Apr 24, 2007 7:03 am

Post by Ar4i »

I might not have used the appropriate term, by saving to DB I ment that I save the template as single RichView document into a single DB Field (e.g. I just use the data aware TDBRichEdit). So basicly I also need a way to modify the document before saving it (e.g. before posting to db). Actually it turns out that I would need to display a modified version of what is stored into the DB, edit it and then store modified version again.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you make changes in the document using non-editing methods, call:
table.Edit;
dbrichviewedit.Change;
table.Post; // if you need to save changed immediately
Ar4i
Posts: 30
Joined: Tue Apr 24, 2007 7:03 am

Post by Ar4i »

Actually the user makes changes and I would only need to replace things like //query12232:field22313// with tag [1] for example (on load) and then replace tag [1] back to text //query12232:field22313// on post. I'll try to use OnLoadDocument for the first and then BeforePost query event for the second.
Thanks for the help, your components will help me make one very nice template editor.
Post Reply