線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2835
推到 Plurk!
推到 Facebook!

用Word製作--九九乘法表

 
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-09-30 00:07:23 IP:218.163.xxx.xxx 未訂閱
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;    type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;
  WordApp:Variant;
  NewDoc:Variant;
  NewTable:Variant;
  Range:Variant;    implementation
  uses comobj;
{$R *.dfm}
//開啟word
procedure TForm1.Button1Click(Sender: TObject);
begin
 WordApp :=CreateOleObject('word.application');
 WordApp.visible :=True;
 NewDoc :=WordApp.Documents.add;
 Range :=WordApp.Selection.Range;
 NewTable :=NewDoc.tables.Add(range,10,10);
end;    //寫入九九乘法
procedure TForm1.Button2Click(Sender: TObject);
var
i,j,s:Integer;
begin
for i:=1 to 10 do
 for j:=1 to 10 do
  begin
   s:=i*j;
   NewTable.cell(i,j).Range.Text:=IntToStr(i) '*' IntToStr(j) '=' IntToStr(s);
 end;
end;
end.
網海無涯,學無止境! 發表人 - qoo1234 於 2003/09/30 00:08:29
系統時間:2024-05-05 9:27:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!