Einzelnen Beitrag anzeigen

strom

Registriert seit: 23. Aug 2008
Ort: Keine Ergebnisse gefunden
290 Beiträge
 
#1

StringGrid speichern

  Alt 5. Mai 2016, 20:53
hallo,

habe das Problem, dass im Textfile ein Zeilenumbruch ausführt wird??? Warum???
Liegt es an CommaText?

Delphi-Quellcode:
procedure SaveStringGridToFile(StringGrid: TStringGrid; const FileName: String);
var
   F: TStringList;
   i: Integer;
begin
   F := TStringList.Create;
   try
     F.Add(IntToStr(StringGrid.RowCount));
     F.Add(IntToStr(StringGrid.ColCount));
     for i := 0 to (StringGrid.RowCount - 1) do
       F.Add(StringGrid.Rows[i].CommaText);
     F.SaveToFile('Test.dat');
   finally
     F.Free;
   end;
end;
wie bekomme ich die Hochkommas rausgefiltert?

Delphi-Quellcode:
procedure TForm1.GlobalExceptionHandler(Sender: TObject; E: Exception);
 var
  i: integer;
  s: String;
begin
 StringGrid2.RowCount := StringGrid2.RowCount + 1;
  for i := StringGrid2.RowCount - 1 downto StringGrid2.FixedRows + 1 do
   StringGrid2.Rows [i].Assign (StringGrid2.Rows [i - 1]);
   StringGrid2.Rows [StringGrid2.FixedRows].Clear;
   StringGrid2.Cells [1,1] := FormatDateTime ('dd.mm.yyyy', Now);
   StringGrid2.Cells [2,1] := FormatDateTime ('hh:nn:ss', Now);
   StringGrid2.Cells [3,1] := 'eGrid Server [Error]';

   s:= E.Message;
   s := StringReplace(s,'´','',[rfReplaceAll]);

   StringGrid2.Cells [4,1] := s;
end;

Geändert von strom ( 5. Mai 2016 um 21:07 Uhr)
  Mit Zitat antworten Zitat