Protect HTML-Tags at the converting RTF->HTML
Posted: Thu May 20, 2010 5:34 pm
My users enter text in a DBRichViewEdit which is stored in a database and then printed to a file as a part of a html-page.
For this, i convert the RTF to HTML with
That works fine ... but sometimes the users must insert a complete html-line like
into the DBRichViewEdit.
(more complex than in this example, so they must insert them as source-code)
After the converting, there is of course
in the source-code.
Is there any possibility to protect all < and > from converting to their entitys?
For this, i convert the RTF to HTML with
Code: Select all
function RTF2Html(rtf:string): string;
var Stream: TStringStream;
rv:TCustomRichView;
begin
rv:=TCustomRichView.Create(nil);
rv.Style:=MyRVStyle1;
Stream := TStringStream.Create('');
Stream.WriteString(rtf);
Stream.Position := 0;
rv.LoadFromStream(Stream,rvynaNo);
Stream.Position := 0;
rv.SaveHTMLToStream(Stream, '', '','',[rvsoMiddleOnly,rvsoDefault0Style]);
result:= Stream.DataString;
stream.free;
rv.Free;
end;
Code: Select all
<img src="http://www.abc.de/def.gif">
(more complex than in this example, so they must insert them as source-code)
After the converting, there is of course
Code: Select all
<img src="http://www.abc.de/def.gif">
Is there any possibility to protect all < and > from converting to their entitys?