Einzelnen Beitrag anzeigen

Benutzerbild von Chemiker
Chemiker

Registriert seit: 14. Aug 2005
1.858 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: StringGrid -> Excel: Kommzahlen als Zahlen einfügen

  Alt 2. Jan 2010, 15:06
Hallo cosypanther,

im StringGrid liegen die Daten als String vor. In Deinem Fall muss der String erst in eine Zahl konvertiert werden.
Zum Bleistift:


Delphi-Quellcode:
var
  Zahl: Extended;
Delphi-Quellcode:
for i := 1 to StringGrid1.RowCount do
for j := 1 to StringGrid1.ColCount do
begin
  if TryStrToFloat(StringGrid1.Cells[j-1, i-1], Zahl) then
  begin
    arrData[i, j]:= Zahl
  end
   else
  begin
    arrData[i, j] := StringGrid1.Cells[j-1, i-1];
  end;
end;
Bis bald Chemiker
wer gesund ist hat 1000 wünsche wer krank ist nur einen.
  Mit Zitat antworten Zitat