文件名称:
excel control by delphi
开发工具:
文件大小: 219kb
下载次数: 0
上传时间: 2006-02-23
详细说明: //About my self excel control ..... study data // for your information... unit toxls5butt; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Excel2000, OleServer; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; CheckBox1: TCheckBox; Button5: TButton; SaveDialog1: TSaveDialog; OpenDialog1: TOpenDialog; // ExcelWorksheet1: TExcelWorksheet; // ExcelOLEObject1: TExcelOLEObject; // ExcelWorkbook1: TExcelWorkbook; // ExcelAppl ication1: TExcelApplication; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private v:variant; sheet:variant; { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation { *.dfm} uses comobj; procedure TForm1.Button1Click(Sender: TObject); begin try V:=createoleobject(‘excel.application‘); v.visible:=checkbox1.Checked; v.workbooks.add; v.workbooks[1].worksheets[1].name:=‘good‘; sheet:=v.workbooks[1].worksheets[1]; sheet.cells[3,1]:=‘31‘; sheet.cells[2,1]:=‘21‘; sheet.cells[1.5]:=‘15‘; sheet.cells[2,2]:=‘22‘; v.workbooks[1].worksheets[2].name:=‘love‘; sheet:=v.workbooks[1].worksheets[2]; sheet.cells[3,4]:=‘34hello‘; // sheet:=v.workbooks[1].worksheets[‘helloaaa‘]; except showmessage(‘excel init load error, not excel or other error!‘); v.displayalerts:=false; v.quit; exit; end; application.Restore; application.BringToFront; end; procedure TForm1.Button2Click(Sender: TObject); begin if opendialog1.Execute then begin try V:=createoleobject(‘excel.application‘); v.visible:=checkbox1.Checked; v.workbooks.open(opendialog1.FileName); except showmessage(‘excel init error, not excel or other error, try again‘); v.displayalerts:=false; v.quit; exit; end; application.Restore; application.BringToFront; end; end; procedure TForm1.Button3Click(Sender: TObject); begin try if not varisempty(v) then begin v.DisplayAlert:=true; v.workbooks[1].close(true,‘c:untitled.xls‘); v.workbooks[1].close(true,‘*.xls‘); v.quit; end; finally close; end; end; procedure TForm1.Button4Click(Sender: TObject); begin if opendialog1.Execute then begin try v:=createoleObject(‘excel.application‘); v.visible:=checkbox1.Checked; v.workbooks.open(opendialog1.FileName); sheet:=v.workbooks[1].worksheet[1]; sheet.pagesetup.printtitlerows:=‘$1:$3‘; //page head sheet.pagesetup.printtitlecolumns:=‘‘; sheet.pagesetup.leftfooter:=‘Noted: PageHead‘+‘sum total&N page ‘+‘--No.&Page‘; //pagehead sheet.pagesetup.leftmargin:=30; //偞离?擒 Sheet.PageSetup.RightMargin := 30; Sheet.PageSetup.TopMargin := 30; Sheet.PageSetup.BottomMargin := 50; Sheet.PageSetup.PrintQuality := 300; //賤昴僅(跦?荂桶
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.