HTML to TRichViewEdit and enabling the Link action

General TRichView support forum. Please post your questions here
Post Reply
kurtbilde
Posts: 48
Joined: Mon Jan 12, 2009 10:26 am
Location: Denmark

HTML to TRichViewEdit and enabling the Link action

Post by kurtbilde »

I’m very close to a solution using TRichview, but I have some issues left.


1) The link action is disabled – what do I need to set in order for me to have the link action up and running? It seems like I need to set some event on each TRichViewEdit – doesn’t I ? I have one toolbar but multible TRichViewEdits. It work ok with bold, italic actions but not with InsertLink action.

2) When do I convert the HTML from the database so it will show up in each TRichViewEdit fields? At OnShow or… Does anybody have a generic convert procedure like:

procedure ConvertToRTF(FieldValue: WideString; var RichviewEdit: TRichViewEdit);

begin

try

OpretFBElementForm.RvHtmlImporter1.RichView := RichviewEdit;

OpretFBElementForm.RvHtmlImporter1.LoadHtml(FieldValue);

finally

RichviewEdit.Format;

end;

end;

Do I have to take care of anything, like UTF8 or....

TIA,

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

Post by Sergey Tkachenko »

1. Include rvoTagsArePChars in RichViewEdit.Options. It is necessary to allow tags (additional value associated with each item in document) to store strings - hyperlinks targets.
Also, process OnReadHyperlink and OnWriteHyperlink events (just copy their code from the ActionTest demo). They are necessary for RTF.

2. Do you want to use TDBRichViewEdit to display and edit HTML fields? In this case use the events OnLoadCustomFormat and OnSaveCustomFormat.
kurtbilde
Posts: 48
Joined: Mon Jan 12, 2009 10:26 am
Location: Denmark

Post by kurtbilde »

Thanks for the reply!

I need to remove the font elements as well but it seems manageable as well!

All the best!

-Kurt
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I forget to answer about encoding.
TrvHtmlImporter understand only two encodings: ANSI (the current system code page) and UTF-8.
It has Encoding property. But even if this property is set to ANSI, if HTML text begins from UTF-8 byte order mark character, it loads it as UTF-8.
Post Reply