Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to read or write in the summary information of an Office document Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
18-Jun-03
Category
OLE
Language
Delphi 6.x
Views
176
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Bertrand Goetzmann

How read or write in the summary information of an Offiche document ?

Answer:

An Office document file is a structured storage file that an application can read 
with the StgOpenStorage function from the Windows API. This kind of file is made of 
storages and streams. 
COM defines a standard common property set for storing summary information about 
document. This information is stored in a stream under the root storage. The 
following function shows how you can get the author property by giving a filename : 

1   uses ActiveX, ComObj, SysUtils;
2   
3   function GetSummaryInfAuthor(FileName: TFileName): string;
4   var
5     PFileName: PWideChar;
6     Storage: IStorage;
7     PropSetStg: IPropertySetStorage;
8     PropStg: IPropertyStorage;
9     ps: PROPSPEC;
10    pv: PROPVARIANT;
11  const
12    FMTID_SummaryInformation: TGUID = '{F29F85E0-4FF9-1068-AB91-08002B27B3D9}';
13  begin
14    PFileName := StringToOleStr(FileName);
15    try
16      // Open compound storage
17      OleCheck(StgOpenStorage(PFileName, nil, STGM_DIRECT or STGM_READ or
18        STGM_SHARE_EXCLUSIVE, nil, 0, Storage));
19    finally
20      SysFreeString(PFileName);
21    end;
22  
23    // Summary information is in a stream under the root storage
24    PropSetStg := Storage as IPropertySetStorage;
25    // Get the IPropertyStorage
26    OleCheck(PropSetStg.Open(FMTID_SummaryInformation, STGM_DIRECT or STGM_READ or
27      STGM_SHARE_EXCLUSIVE, PropStg));
28  
29    // We want the author property value
30    ps.ulKind := PRSPEC_PROPID;
31    ps.propid := PIDSI_AUTHOR;
32  
33    // Read this property
34    PropStg.ReadMultiple(1, @ps, @pv);
35  
36    Result := pv.pszVal;
37  end;


See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgasstg_7agk.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgasstg_7agk.asp for more information about the Summary Information Property Set.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC