Einzelnen Beitrag anzeigen

H3llsing

Registriert seit: 12. Nov 2008
96 Beiträge
 
Delphi 2010 Enterprise
 
#16

AW: Tmemo height dynamisch an text anpassen

  Alt 4. Aug 2010, 14:38
vielen dank, werd ich mir später nochmal anschauen mit dem direkten senden.

hier ist vorerst meine Lösung, die ich nochmal überarbeiten werde sobald ich zeit habe =)
Delphi-Quellcode:
 try
    Mylist := Tstringlist.Create;
    Mylist.LoadFromFile(ExtractFilePath(ParamStr(0))+'html/anfang.html');
    for i := 0 to length(ar_content)-1 do
    begin

      try
        MYBeitrag := Tstringlist.Create;
        MYBeitrag.LoadFromFile(ExtractFilePath(ParamStr(0))+'html/Beitrag.html');
        if FormatDateTime('dd.mm.yyyy',now) = FormatDateTime('dd.mm.yyyy',ar_content[i].datum) then
           header := '#'+intToStr(i+1)+' von '+ar_content[i].ersteller+' um <b>'+FormatDateTime('HH:MM:ss',ar_content[i].datum)+'</b> geschrieben'
        else
           header := '#'+intToStr(i+1)+' von '+ar_content[i].ersteller+' um <b>'+FormatDateTime('dd.mm.yyyy HH:MM:ss',ar_content[i].datum)+'</b> geschrieben';

        ar_content[i].content := StringReplace(ar_content[i].content,#10#13,'<br>',[rfReplaceAll,rfIgnoreCase]);
        ar_content[i].content := StringReplace(ar_content[i].content,#10,'<br>',[rfReplaceAll,rfIgnoreCase]);

        MYBeitrag.Text := StringReplace(MYBeitrag.Text,'[header]',header,[rfReplaceAll,rfIgnoreCase]);
        MYBeitrag.Text := StringReplace(MYBeitrag.Text,'[nr]',intToStr(i+1),[rfReplaceAll,rfIgnoreCase]);
        MYBeitrag.Text := StringReplace(MYBeitrag.Text,'[content]',trim(ar_content[i].content),[rfReplaceAll,rfIgnoreCase]);


        MYlist.Add(trim(MYBeitrag.Text));
      finally
        MYBeitrag.Free;
      end;


    end;
    Mylist.Add('</table></body></html>');
    mylist.SaveToFile(ExtractFilePath(ParamStr(0))+'html/'+Benutzer+'temp.html');
    frmAnfrage.WebBrowser1.Navigate(ExtractFilePath(ParamStr(0))+'html/'+Benutzer+'temp.html');
  finally
    Mylist.Free;
  end;
und hier noch ein kleiner screen
html_loesung.png
  Mit Zitat antworten Zitat