rendered paste bodybegin
TempStyle := RichEdit.Font.Style;
StrLeft := StrToAdd;
RichEdit.SelStart := Length(RichEdit.Text);
while StrLeft <> '' do begin
if (StrStartsWith(StrLeft, '<b>', True, true)) then
begin
// Bold Style
if StrStartsWith(StrLeft, '<b>', True, True) then
AddToStyle(TempStyle, fsBold);
if StrStartsWith(StrLeft, '</b>', True, True) then
RemoveFromStyle(TempStyle, fsBold);
// Italic Style
if StrStartsWith(StrLeft, '<i>', True, True) then
AddToStyle(TempStyle, fsItalic);
if StrStartsWith(StrLeft, '</i>', True, True) then
RemoveFromStyle(TempStyle, fsItalic);
// Underline Style
if StrStartsWith(StrLeft, '<u>', True, True) then
AddToStyle(TempStyle, fsUnderline);
if StrStartsWith(StrLeft, '</u>', True, True) then
RemoveFromStyle(TempStyle, fsUnderline);
// Color
if StrStartsWith(StrLeft, '</c>', True, True) then
RichEdit.SelAttributes.Color := RichEdit.Font.Color;
if StrStartsWith(StrLeft, '<c=', True, True) then begin
TempStr := FromLeftUntilStr(StrLeft, '>', False, True);
try
RichEdit.SelAttributes.Color := StringToColor(TempStr);
except
RichEdit.SelAttributes.Color := RichEdit.Font.Color;
end;
Delete(StrLeft, 1, 1);
end;
end
else
begin
RichEdit.SelAttributes.Style := TempStyle;
RichEdit.SelText := FromLeftUntilStr(StrLeft, '<', True, True);
end;
RichEdit.SelStart := Length(RichEdit.Text);
end;
RichEdit.SelText := #13#10;
end;