1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65:
| function RTFToPlainText(RTF:String):String; var i,j,h:integer; begin RTF:=StringReplace(RTF,'\'+Chr(39)+'f6','ö',[rfReplaceAll]); RTF:=StringReplace(RTF,'\'+Chr(39)+'d6','Ö',[rfReplaceAll]); RTF:=StringReplace(RTF,'\'+Chr(39)+'e4','ä',[rfReplaceAll]); RTF:=StringReplace(RTF,'\'+Chr(39)+'c4','Ä',[rfReplaceAll]); RTF:=StringReplace(RTF,'\'+Chr(39)+'fc','ü',[rfReplaceAll]); RTF:=StringReplace(RTF,'\'+Chr(39)+'dc','Ü',[rfReplaceAll]); RTF:=StringReplace(RTF,'\'+Chr(39)+'df','ß',[rfReplaceAll]);
Repeat i:=Pos('{\f',RTF); if i>0 then begin j:=i; h:=1; Repeat Inc(j); if RTF[j]='{' then Inc(h); if RTF[j]='}' then Dec(h); Until ((RTF[j]='}') and (h=0)) or (j=Length(RTF)); if ((RTF[j]='}') and (h=0)) then begin Delete(RTF,i,j-i+1); end; end; Until i=0;
i:=1; While (i<Length(RTF)) do begin
if RTF[i]='\' then begin j:=i; While (RTF[j]<>' ') and (j<Length(RTF)) and (RTF[j+1]<>'ä') and (RTF[j+1]<>'ö') and (RTF[j+1]<>'ü') and (RTF[j+1]<>'Ä') and (RTF[j+1]<>'Ö') and (RTF[j+1]<>'Ü')
do Inc(j); Delete(RTF,i,j-i+1); end else Inc(i); end; RTF:=StringReplace(RTF,#$D#$A,' ',[rfReplaceAll]); RTF:=StringReplace(RTF,';',' ',[rfReplaceAll]); RTF:=StringReplace(RTF,'{',' ',[rfReplaceAll]); RTF:=StringReplace(RTF,'}',' ',[rfReplaceAll]);
Result:=Trim(RTF); if Result='' then Result:=' '; end; |