unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, excel2000, StdCtrls, ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
EApp,workbook:variant;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
EApp := CreateOleObject( 'Excel.Application' );
EApp.Workbooks.Open('d:\book4.xls');
EApp.Visible:=true;
EApp.worksheets[1].activate;
EApp.ActiveSheet.Range['re1'].Value :='test';
//--re1为excel单元格别名
EApp.quit;
end;
end.
delphi 用别名的方式访问excel写入数据,实现非标格式报表输出
最新推荐文章于 2019-11-01 08:10:25 发布