【DO!BOOK・ページリンク】
2008_migaro_techreport_001   89 / 136

BOOKをみる

10秒後にBOOKのページに移動します


87 ソース1 uses ComObj; procedure TForm1.Button1Click(Sender: TObject); var MsExcel, MsApplication, WBook, WSheet: OleVariant; i: integer; begin //Excel 起動 MsExcel := CreateOleObject('Excel.Application'); MsApplication := MsExcel.Application; MsApplication.Visible := True; WBook := MsApplication.WorkBooks.Add; WSheet :=WBook.ActiveSheet; //Excel にタイトル出力 WSheet.Cells[1,3].Value := ' 得意先マスター一覧表'; WSheet.Cells[1,3].Font.Size := 15; WSheet.Cells[2,1].Value := ' 得意先コード'; WSheet.Cells[2,2].Value := ' 得意先名'; WSheet.Cells[2,3].Value := ' 住所'; WSheet.Cells[2,1].Font.Bold := 'True'; WSheet.Cells[2,2].Font.Bold := 'True'; WSheet.Cells[2,3].Font.Bold := 'True'; //Excel にデータ出力 with Table1 do begin Active := True; try i := 0; First; while not eof do begin WSheet.Cells[i+3,1].Value := FieldByName('CUSTNO'). AsInteger; WSheet.Cells[i+3,2].Value := FieldByName('COMPANY').AsString; WSheet.Cells[i+3,3].Value := FieldByName('ADDR1'). AsString; Next; i := i + 1; end; finally Active := False; end; end; end; ソース2 unit Unit1; {$WARN SYMBOL_PLATFORM OFF} interface uses ComObj, ActiveX, AS400Info_TLB, StdVcl; type TAS400Infomation = class(TAutoObject, IAS400Infomation) protected function Get_CustName: WideString; safecall; function Get_CustNo: Integer; safecall; procedure GetData; safecall; procedure Set_CustNo(Value: Integer); safecall; end; implementation uses ComServ; function TAS400Infomation.Get_CustName: WideString; begin end; function TAS400Infomation.Get_CustNo: Integer; begin end; procedure TAS400Infomation.GetData; begin end; procedure TAS400Infomation.Set_CustNo(Value: Integer); begin end; initialization TAutoObjectFactory.Create(ComServer, TAS400Infomation, Class_AS400Infomation, ciMultiInstance, tmApartment); end.