如题!特急!谢谢,

解决方案 »

  1.   

    oWord:Word.Application
    oWord.ActiveDocument.BuiltInDocumentProperties(Index).valueIndex=1 标题(Title)
    Index=2 主题(Subject)
    Index=3 作者(Author)
    Index=4 关键词(Keywords)
    Index=5 备注(Comments)
    Index=6 模板(Template)
    Index=7 单位(Last author)
      

  2.   

    uses
       ComObjfunction IsFileInUse(const FileName:String):Boolean;
    var
       FileStrm:TFileStream;
    begin
       Result:=false;
       try
          FileStrm:=TFileStream.Create(FileName,fmOpenReadWrite);
          FileStrm.Free;
       except
          Result:=true;
       end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
       oWord:OleVariant;
       FileName:String;
    begin
      FileName:='C:\Documents and Settings\Administrator\Desktop\料品库存异动汇总表.doc';
      if not FileExists(FileName) then exit;
      if IsFileInUse(FileName) then exit;//检查文件是否被打开,否则不能修改
      oword := CreateOLEObject('Word.Application');
      Sleep(100);//等待Word启动
      oword.documents.open(FileName);
      oWord.ActiveDocument.BuiltInDocumentProperties(1):='测试修改Word文档属性'; //标题(Title)
      oWord.ActiveDocument.BuiltInDocumentProperties(2):='修改Word相关信息';     //主题(Subject)
      oWord.ActiveDocument.BuiltInDocumentProperties(3):='最好玩滴那个';         //作者(Author)
      oWord.ActiveDocument.BuiltInDocumentProperties(4):='修改 文档 属性';       //关键词(Keywords)
      oWord.ActiveDocument.BuiltInDocumentProperties(5):='就是最好玩滴那个干滴好事啦,嘻嘻';//备注(Comments)
      //oWord.ActiveDocument.BuiltInDocumentProperties(6) //模板(Template)
      oWord.ActiveDocument.BuiltInDocumentProperties(7):='不记得是在哪个单位了'; //单位(Last author)
      oword.ActiveDocument.Save;
      oword.quit;
    end;