将excel隐藏
另外导数据之前:
dbgrid.datasource.dataset.disablecontrols;
导完之后
dbgrid.datasource.dataset.enablecontrols;
具体代码:放一个progressbar作为进度条,设置step为1
procedure export(grid:TDBGrid; progress:TProgressBar);
var
ds:TDataSet;
begin
ds := grid.datasource.dataset;
if ds = nil then exit;
ds.disablecontrols;
ds.first;
while not ds.eof do
begin
//导出代码....
ds.next;
progress.stepit;//进度
end;
ds.enablecontrols;
end;