以下是我的代码:Excel内的数据行数 〉10000行,所以我用了virtual list view 来显示。但是我还想把Excel的纪录放入一个结构ClientStruct里面,但是这样执行过后,list view的显示一切正常,速度很快,但是结构里却只存了18行纪录。为什么只有18行,Excel文件里可是有10000行啊?? 如果我不把结构放在ondata 事件里,执行将非常慢。
procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
var
  substr, substr1: string;
  j: integer;
begin
  if item.Index <= Excel_row_count then
  begin
  j:= item.Index;
  Item.Caption:= IntToStr(j+1);  substr1:= trim(ExcelWorkSheet1.Cells.Item[j+1,2]);
  substr2:= trim(ExcelWorkSheet1.Cells.Item[j+1,3]);  ClientStruct[j].addr:= substr1;
  ClientStruct[j].company:= substr2;  Item.SubItems.Add(substr1);
  Item.SubItems.Add(substr2);
  end;
end;