以下是我的代码: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;
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;
解决方案 »
- 奇怪,delphi中,查询后插入新表,为什么解决不了?(连的是access)
- 求救环境出错问题.
- listview问题,急!!!
- ★★★黄金Delphi职业,年薪4万美元以上,可是有点怪。。★★★
- Wise for Windows Installer中如何使安装的某些文件不被覆盖
- 如何得到一个文件的完整路径。
- 模糊查询
- (紧急)怎样设置使微软TTS发出中文语音
- 怎样检测(实时)某目录下是否有新的文件(图片)加入?如果有将其插入到数据库中?
- delphi版中秋节副本贴:有多少人今天会和家人一起过中秋?有多少今天可是可女朋友在一起的?又有多少人今天是流浪在外?
- 请问这句Select语句要怎么写?
- 急急急!!!数据库高手请进!!!!!!!!
比频繁读取EXCEL文件效率高很多。