Try ExcelApplication1.Connect; Except End; ExcelApplication1.Visible[0]:=True; |
ExcelWorkbook1.ConnectTo(ExcelApplication1 Workbooks.Add(EmptyParam,0)); |
Var Temp_Worksheet: _WorkSheet; Begin Try Temp_Worksheet:=ExcelWorkbook1. WorkSheets.Add(EmptyParam, EmptyParam,EmptyParam,EmptyParam,0) as _WorkSheet; ExcelWorkSheet1.ConnectTo(Temp_WorkShee); Except ShowMessage(′Failure′); End; |
Try ExcelApplication1.Quit; ExcelWorksheet1.Disconnect; ExcelWorkbook1.Disconnect; ExcelApplication1.Disconnect; Except End; End; |
if OpenDialog1.Execute then Begin Try ExcelWorkBook1.ConnectTo(Excel Application1.Workbooks.Open(OpenDialog1FileName,EmptyParam,EmptyParam,Empty Param, EmptyParam, EmptyParam, EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam, EmptyParam,EmptyParam,0)); ExcelWorkSheet1.ConnectTo(ExcelWorkBook1.Activesheet as _Worksheet); Except; End; |
Procedure TForm1.buttonclick(sender:tobject); Begin Shellexecute(handle,’open’,’ c:\sh60\sh60.exe’,’,’,sw-shownormal); Button3.enabled:=false; End; Procedure TForm1.formcreat(sender:tobject); Var i:integer: Begin Chdir(‘c:\sh60’); Form1.edit1.clear; Form1.memo1.clear; Assignfile(textid,form1.opendialog1.filename); For i:=1 to form1.adoquery1.sql.count do Begin Form1.adoquery1.close; Form1.adoquery1.clear; Form1.adoquery1.sq1.add(‘select 表名 from Formname’)close; Form1.adoquery1.open; Form1.dbcombox1.datafield:=’表名’; End; |
ADODataSet1.Connection :=ADOConnection1; ADODataSet1.CommandText :=select * from test; ADODataSet1.Active :=True; DataSource1.DataSet :=ADODataSet1; DBGrid1.DataSource :=DataSource1; |