Delphi(程序人生)

Delphi Programer DoubleCat

导航

打开word文件

procedure TfjfsglForm.SpeedButton4Click(Sender: TObject);

    var

    MSWord: Variant;

    str:string;

    begin

      if trim(DataModule1.adoquery27.fieldbyname('fjmc').asstring)<>'' then

      begin

        str:=trim(DataModule1.ADOQuery27.fieldbyname('fjmc').AsString);

        MSWord:= CreateOLEObject('Word.Application');//

        MSWord.Documents.Open('d:\Program Files\Common Files\Sfa\'+str, True);//

        MSWord.Visible:=1;//

        str:='';

        MSWord.ActiveDocument.Range(0, 0);//

        MSWord.ActiveDocument.Range.InsertAfter(str);//?úWord?D???ó×?·?'Title'

        MSWord.ActiveDocument.Range.InsertParagraphAfter;

      end

      else

      showmessage('');

    end;

posted on 2008-06-14 17:18  DoubleCat  阅读(595)  评论(0编辑  收藏  举报