Delphi-Quellcode:
var
i, j : Integer;
NewItem: TlistItem;
clmen: TListColumn;
k : integer;
begin
ListView1.Clear;
SG.ColCount := 0;
SG.RowCount := 0;
if Assigned(Rows) then
begin
SG.RowCount := length(Rows[0]) + 1;
SG.ColCount := length(Cols);
SG.FixedRows := 0;
listview1.Columns.Clear;
Listview1.Clear;
for i := 0 to length(Cols) - 1 do
begin
SG.Cols[i].Add(Cols[i]);
SG.Cells[i, 0] := Cols[i];
end;
for i := 0 to length(Cols) - 1 do
begin
for j := 0 to length(Rows[0]) - 1 do
begin
SG.Cells[i, j + 1] := Rows[i, j];
end;
end;
end;
if Assigned(Rows) then
begin
for i := 0 to length(Cols) - 1 do
begin
clmen := ListView1.Columns.Add;
clmen.Caption := Cols[i];
end;
for k := 0 to length(rows[0]) + 1 do
begin
NewItem := ListView1.Items.Add;
NewItem.Caption := '';
for i := 0 to length(rows) + 1 do
NewItem.SubItems.Add('');
end;
end;
k := -2; /// Ab hier verändert ///
for i := 0 to length(Cols) - 1 do
begin
inc(k);
for j := 0 to length(Rows[0]) - 1 do
begin
if k = -1 then
begin
ListView1.Items[j].Caption := Rows[i, j];
end
else
begin
ListView1.Items[j].SubItems[k] := Rows[i, j];
end;
end;
end;
end;
Wen es interessiert, hier ist es richtig, hab den Fehler gerfunden.