如何获取、设置 Word、Excel 的作者、标题、主题、备注等摘要信息? ( 积分: 100 )

  • 主题发起人 主题发起人 wgqsoft
  • 开始时间 开始时间
W

wgqsoft

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么一个回答的都没有
 
我也相知道,给你顶一下
 
得到WORD的作者、页数、名称<br><br>uses<br> &nbsp;Comobj;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>const<br> &nbsp;wdPropertyTitle &nbsp; = $00000001;<br> &nbsp;wdPropertySubject = $00000002;<br> &nbsp;wdPropertyAuthor &nbsp;= $00000003;<br> &nbsp;wdPropertyKeywords = $00000004;<br> &nbsp;wdPropertyComments = $00000005;<br> &nbsp;wdPropertyTemplate = $00000006;<br> &nbsp;wdPropertyLastAuthor = $00000007;<br> &nbsp;wdPropertyRevision = $00000008;<br> &nbsp;wdPropertyAppName = $00000009;<br> &nbsp;wdPropertyTimeLastPrinted = $0000000A;<br> &nbsp;wdPropertyTimeCreated = $0000000B;<br> &nbsp;wdPropertyTimeLastSaved = $0000000C;<br> &nbsp;wdPropertyVBATotalEdit = $0000000D;<br> &nbsp;wdPropertyPages &nbsp; = $0000000E;<br> &nbsp;wdPropertyWords &nbsp; = $0000000F;<br> &nbsp;wdPropertyCharacters = $00000010;<br> &nbsp;wdPropertySecurity = $00000011;<br> &nbsp;wdPropertyCategory = $00000012;<br> &nbsp;wdPropertyFormat &nbsp;= $00000013;<br> &nbsp;wdPropertyManager = $00000014;<br> &nbsp;wdPropertyCompany = $00000015;<br> &nbsp;wdPropertyBytes &nbsp; = $00000016;<br> &nbsp;wdPropertyLines &nbsp; = $00000017;<br> &nbsp;wdPropertyParas &nbsp; = $00000018;<br> &nbsp;wdPropertySlides &nbsp;= $00000019;<br> &nbsp;wdPropertyNotes &nbsp; = $0000001A;<br> &nbsp;wdPropertyHiddenSlides = $0000001B;<br> &nbsp;wdPropertyMMClips = $0000001C;<br> &nbsp;wdPropertyHyperlinkBase = $0000001D;<br> &nbsp;wdPropertyCharsWSpaces = $0000001E;<br>var<br> &nbsp;vWord, vDoc, docBuiltInProps, typeDocBuiltInProps: Variant;<br>begin<br> &nbsp;if not OpenDialog1.Execute then<br> &nbsp; &nbsp;Exit;<br> &nbsp;vWord := CreateOleObject('Word.Application'); //创建Word线程<br> &nbsp;try<br> &nbsp; &nbsp;//打开要操作的文件<br> &nbsp; &nbsp;vDoc := vWord.Documents.Open(OpenDialog1.FileName);<br> &nbsp; &nbsp;docBuiltInProps := vDoc.BuiltInDocumentProperties;<br> &nbsp; &nbsp;memo1.Lines.Add(format('%s : %s', ['页数',<br> &nbsp; &nbsp; &nbsp;vDoc.BuiltInDocumentProperties[wdPropertyPages].Value]));<br> &nbsp; &nbsp;memo1.Lines.Add(format('%s : %s', ['作者',<br> &nbsp; &nbsp; &nbsp;vDoc.BuiltInDocumentProperties[wdPropertyAuthor].Value]));<br> &nbsp; &nbsp;memo1.Lines.Add(format('%s : %s', ['标题',<br> &nbsp; &nbsp; &nbsp;vDoc.BuiltInDocumentProperties[wdPropertyTitle].Value]));<br> &nbsp;finally<br> &nbsp; &nbsp;vDoc.Close(True); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //关闭文并保存<br> &nbsp; &nbsp;vWord.Quit(False); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//退出Word<br> &nbsp;end;<br>end;
 
请查阅office VBA文档即可。
 
后退
顶部