create and send HyperLink by email

General TRichView support forum. Please post your questions here
Post Reply
RoniTevel
Posts: 8
Joined: Fri Mar 12, 2010 1:29 am

create and send HyperLink by email

Post by RoniTevel »

Hi There
I use a TRichViewEdit compnent to edit email body.
i need to add HyperLink to the email body and
make shure it will be link when sending it by email.

Rve.SaveHTML(EmailTempFile, '', 'img', [rvsoOverrideImages,rvsoOverrideImages]);
HtmlBody:=FileToStr(EmailTempFile); //***-
if cbxHebrew.Checked then
HtmlBody:=StrTran(HtmlBody,'dir=LTR','dir=RTL');

any idea how to do it?
Roni
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Store a hyperlink target in the item Tag.
If you use RichViewActions, TrvActionInsertHyperlink does all work for you.
If not, see the demo in Demos\*\Assorted\Hypertext\CreateHyperlink

To save hyperlinks in HTML, use OnWriteHyperlink event:

Code: Select all

procedure TfrmMain.rveWriteHyperlink(Sender: TCustomRichView; id: Integer;
  RVData: TCustomRVData; ItemNo: Integer; SaveFormat: TRVSaveFormat;
  var Target, Extras: string);
begin
  Target := RVData.GetItemTag(ItemNo);
end;
RoniTevel
Posts: 8
Joined: Fri Mar 12, 2010 1:29 am

Post by RoniTevel »

Thnks Sergey.
can you upload code sample how to
store a hyperlink in item tag?
Roni
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you do not use RichViewActions, see the demo in Demos\*\Assorted\Hypertext\CreateHyperlink

What exactly do you want to know?

In this demo, you can see how hyperlinks are created:
- for inserting a new hyperlink, InsertStringTag is used
- for making a hyperlink from the selected text, ApplyStyleConversion and SetItemTagEd are used.

No additional code is required to store tags in RVF (in older version of TRichView, it was required to include rvoTagsArePChars in Options, but now it is not needed).
To save hyperlinks in HTML or RTF, OnWriteHyperlink is used, as I said above.
To read hyperlinks from RTF, OnReadHyperlink is used.
Post Reply