Home » Tutorials » Sonstiges » rtf2html

rtf2html

Schritt 7

HTML-Code hat die Angwohnheit, manche Zeichen nicht wirklich zu mögen. Deshalb wird jetzt dieser Teil gesäubert:

 // jetzt wird erst mal alles gesäubert, was in der HTM-Datei nicht so nett
    // aussehen würde
    if source.SelText='"' then
      s:=s+'"'
     else
    if source.SelText='<' then
      s:=s+'<'
     else
    if source.SelText='>' then
      s:=s+'>'
     else
    if source.SelText='ä' then
      s:=s+'ä'
     else
    if source.SelText='Ä' then
      s:=s+'Ä'
     else
    if source.SelText='ö' then
      s:=s+'ö'
     else
    if source.SelText='Ö' then
      s:=s+'Ö'
     else
    if source.SelText='ü' then
      s:=s+'ü'
     else
    if source.SelText='Ü' then
      s:=s+'Ü'
     else
    if source.SelText='ß' then
      s:=s+'ß'
     else
      s:=s+Source.SelText;
  end; // jedes Zeichen

Wir haben also alle , Umlaute etc. richtig umgewandelt. Das „end“ am Schluss gehört zu der alles umfassenden for-Schleife.