//打开excel
procedure TForm1.Button1Click(Sender: TObject);
begin
xlApp.Connect;
xlApp.Visible[0] := True;
xlApp.AlertBeforeOverwriting[0] := False;
xlBook.ConnectTo(xlApp.Workbooks.Add(NULL, 0));
xlSheet.ConnectTo(xlBook.Sheets[1] as _WorkSheet);
end;
//粘贴过去
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
chart1.CopyToClipboardBitmap;
xlSheet.Paste;
// xlApp.Save('文件名'); 如果马上要保存,将//去掉
end;
一些Excel细节上的控制,可以到OLEAUTOMATION版看看
http://www.delphibbs.com/delphibbs/dispq.asp?lid=759711
http://www.djpate.freeserve.co.uk/Automation.htm