从粘贴板粘贴数据到STRINGGRID中最快的方法是什么?(100分)

Q

quharry

Unregistered / Unconfirmed
GUEST, unregistred user!
如果我从EXCEL中COPY了1W行数据,要贴到一个StringGrid中,第一种方法可以从指定的行
贴入,但是速度较慢;第二种方法速度较快,但是不能指定贴入位置,都是从第0行贴入。
请问有指定位置贴入,又能较快的方法吗?
uses
clipbrd;
1、循环
var
i:integer;
strlist:TstringList;
strlist:=TStringList.Create;
strlist:=ClipBoard.AsText;
if strlist.count > (strGrid.RowCount - strGrid.Row) then

strGrid.RowCount :=strGrid.Row + strlist.Count;
for i:=0 to strlist.Count -1do
begin
strGrid.Cells[0,strGrid.Row + i]:=strlist.Strings;
end;
2、直接PasteFromClipBoard
strlist:TstringList;
strlist:=TStringList.Create;
strlist:=ClipBoard.AsText;
if strlist.count > (strGrid.RowCount - strGrid.Row) then

strGrid.RowCount :=strGrid.Row + strlist.Count;
strGrid.Cols[0].Text:=ClipBoard.AsText;
 
已解决!
用的第一种方法!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
436
import
I
I
回复
0
查看
393
import
I
顶部