下面的程序绝对比你用F1book6好,但机器必须有Excel
unit InsertBMP;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
ComObj,//必须有这个
Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
OpenExcel: TButton;
InsertBMP: TButton;
ExitPro: TButton;
procedure OpenExcelClick(Sender: TObject);
procedure InsertBMPClick(Sender: TObject);
procedure ExitProClick(Sender: TObject);
private
XLApp,WorkBook,WorkSheet:Variant;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//打开Excel 按钮事件
procedure TForm1.OpenExcelClick(Sender: TObject);
begin
XLApp:=CreateOleObject('Excel.Application')
//对各版本的Excel都适用
WorkBook:=XLApp.WorkBooks.add;
xlapp.visible:=true;
WorkSheet:=WorkBook.sheets[1];
end;
//插入图片按钮事件
procedure TForm1.InsertBMPClick(Sender: TObject);
begin
//插入一张图片在当前位置
WorkSheet.Pictures.Insert('C:/WINDOWS/安装程序.bmp');
end;
//退出程序事件
procedure TForm1.ExitProClick(Sender: TObject);
begin
xlapp.quit;
close;
end;
end.
(***************)