procedure TForm1.BitBtn11Click(Sender: TObject);<br> var v:variant;<br>sheet:variant;<br>str:string;<br>i,j,z,a:integer;<br>begin<br>v:=createoleobject('Excel.Application');<br>v.visible:=false;<br>v.workbooks.open(extractfilepath(application.ExeName)+'3050周销售报表(各处).xls');//添加工作表<br>sheet:=v.sheets['部门'];<br>v.sheets['部门'].activate;<br>adoquery5.First ;<br>{while not adoquery1.Eof do<br> begin<br> sheet.Cells.Item[i,1]:= adoQuery1.FieldByName('销售额').AsVariant ;<br> sheet.Cells.Item[i,2]:= adoQuery1.FieldByName('毛利率').AsVariant;<br> sheet.Cells.Item[i,3]:= adoQuery1.FieldByName('总库存').Asinteger;<br> sheet.Cells.Item[i,4]:= adoQuery1.FieldByName('周转率').Asfloat;<br> sheet.Cells.Item[i,5]:= adoQuery1.FieldByName('处名称').Asstring;<br> sheet.Cells.Item[i,6]:= adoQuery1.FieldByName('date').AsString;<br> adoquery1.Next;<br> i:=i+1;<br> end; }<br>//a:=adoquery5.RecordCount div 5;<br>i:=3;<br>while not adoquery5.Eof do<br> begin<br> for j:=2 to 22 do<br> begin<br> z:=j;<br> sheet.Cells.Item[i,z]:= adoQuery5.FieldByName('销售额').AsVariant ;<br> z:=j+21;<br> sheet.Cells.Item[i,z]:= adoQuery5.FieldByName('毛利率').AsVariant;<br> adoquery5.Next;<br> end;<br> inc(i);<br> end;<br><br> i:=3;<br> adoquery8.First ;<br> adoquery9.First ;<br> while not adoquery8.Eof do begin<br> for j:=1 to 5 do<br> begin<br> sheet.Cells.Item[i,43+j]:= adoQuery9.FieldByName('毛利率').Asfloat ;<br> adoquery9.Next ;<br> end;<br> sheet.Cells.Item[i,1]:= adoQuery8.FieldByName('date').Asstring ;<br> inc(i);<br> adoquery8.Next;<br> end; <br><br>像这样的如果导出的数据少的话还可以,多的话太慢了。有没有可以快一点的方法?