Slight enhancement of the previous function for creating multiline text
function StripHTMLTags(strHTML: string): string;
const crlf='&crlf;';
var
P: PChar;
InTag: Boolean;
i, intResultLength: Integer;
begin
strHTML:=StringReplace(strHTML, '<br/>',crlf,[rfReplaceAll, rfIgnoreCase]);
strHTML:=StringReplace(strHTML, '</div>',crlf,[rfReplaceAll, rfIgnoreCase]);
P := PChar(strHTML);
Result := '';
InTag := False;
repeat
case P^ of
'<': InTag := True;
'>': InTag := False;
#13, #10: ; {do nothing}
else
if not InTag then
begin
if (P^ in [#9, #32]) and ((P+1)^ in [#10, #13, #32, #9, '<']) then
else
Result := Result + P^;
end;
end;
Inc(P);
until (P^ = #0);
{convert system characters}
Result := StringReplace(Result, '"', '"', [rfReplaceAll]);
Result := StringReplace(Result, ''', '''', [rfReplaceAll]);
Result := StringReplace(Result, '>', '>', [rfReplaceAll]);
Result := StringReplace(Result, '<', '<', [rfReplaceAll]);
Result := StringReplace(Result, '&', '&', [rfReplaceAll]);
Result := StringReplace(Result, crlf, #13#10, [rfReplaceAll]);
end;