概要

没有服务器正在运行甚至安装使用标准接口从文档可检索复合文档属性。 例如, 可检索内置文档属性如 Microsoft Office 97 文档的作者、 上次修改时间和页数属性以及其他自定义文档属性。

更多信息

以下步骤说明如何生成复合文档属性查看器与 VisualC++ Microsoft。 示例是一个 Win 32 控制台应用程序项目, 并可修改以满足需要。

步骤创建示例

1. 创建新的 Win 32 控制台应用程序项目, 并 PropDump 调用它。
2. 添加新文件称为 main.cpp 到项目。
3. 将以下代码复制到 main.cpp:
            
用VC读取复合文档属性   #include <stdio.h>
用VC读取复合文档属性   #include 
<windows.h>
用VC读取复合文档属性   #include 
<ole2.h>
用VC读取复合文档属性   #include 
<locale.h>
用VC读取复合文档属性
用VC读取复合文档属性
用VC读取复合文档属性
用VC读取复合文档属性   
// Dumps simple PROPVARIANT values.
4. 编译程序。
要运行示例, 您应将 PropDump.exe 文件默认路径中目录 ; 例如 c:\Windows\ 或 c:\Windows\Command\。 在包含复合文档文件, 目录, 然后键入 PropDump 跟文件的名称。 您应看到类似于以下输出:

 ================================================== 
           Title: MyTitle (VT_LPSTR)
         Subject: MySubject (VT_LPSTR)
          Author: MyAuthor (VT_LPSTR)
        Keywords: MyKeywords (VT_LPSTR)
        Comments: MyComments (VT_LPSTR)
        Template: Normal (VT_LPSTR)
      LastAuthor: Me (VT_LPSTR)

 Revision Number: 8 (VT_LPSTR)

       Edit Time: 01:05.47 pm, Mon 01/01/1601 (VT_FILETIME)
    Last printed: (VT_EMPTY)
         Created: 01:42.00 pm, Fri 05/29/1998 (VT_FILETIME)
      Last Saved: 12:31.00 pm, Mon 06/01/1998 (VT_FILETIME)
      Page Count: 1 (VT_I4)
      Word Count: 3 (VT_I4)
      Char Count: 19 (VT_I4)
       Thumpnail: (VT_EMPTY)
         AppName: Microsoft Word 8.0 (VT_LPSTR)
    Doc Security: 0 (VT_I4)
                ================================================== 
 
   _PID_LINKBASE: (VT_BLOB)

       _PID_GUID: (VT_BLOB)
       CustProp1: CustProp1TextValue (VT_LPSTR)
       CustProp2: 77777 (VT_I4)
       CustProp3: TRUE/YES (VT_BOOL)
       CustProp4: 00:00.00 am, Tue 05/17/1977 (VT_FILETIME)
   

其他备注

是原始版本的 COM 中未定义 IPropertyStorage 和 IPropertySetStorage 接口 ; 因此示例代码需要与系统:
Windows NT 4.0 或更高
Windows 95 与 Internet Explorer Version 4.0 或更高版本
用安装 DCOM 95
非常指定 COM 的早期版本少用尊重和属性及其用法, 但做定义序列化格式允许开发人员 IStorage 实例中存储属性和属性集。 还定义属性标识符和语义的单个属性集, 用于文档, 摘要信息。 此时, 它是需要创建和操纵结构直接作为数据流。 有关详细信息属性上设置序列化数据格式结构, 在 Microsoft Developer Network 引用到 " OLE 系列属性设置格式 "。

(c) Microsoft Corporation 1999, 保留所有权利。 由 Joe, Crump MicrosoftCorporation 供稿。
 

参考

Microsoft Developer Network: 永久属性集

Microsoft Developer Network: OLE 序列属性设置格式
 

这篇文章中的信息适用于:
Microsoft Project 2000 Standard Edition
Microsoft Excel 2000 Standard Edition
Microsoft Visual C++ 5.0 Enterprise Edition
Microsoft Visual C++ 5.0 Professional Edition
Microsoft Excel 97 Standard Edition
Microsoft PowerPoint 97 Standard Edition
Microsoft Word 97 Standard Edition
Microsoft PowerPoint 2000 Standard Edition
Microsoft Word 2000 Standard Edition
Microsoft Excel 2002 Standard Edition
Microsoft PowerPoint 2002 Standard Edition
Microsoft Word 2002 Standard Edition

相关文章:

  • 2021-09-22
  • 2021-05-25
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2021-06-21
  • 2021-06-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案