The information in this article applies to:
SUMMARYDsofile.exe is a self-extracting executable that provides an in-process ActiveX DLL for Visual Basic programmers to use in order to read or modify the Document Summary Properties for an OLE Structured Storage file. Because Word, Excel, and PowerPoint use OLE Structured Storage to save their files to disk, this DLL lets programmers view and change document properties without the need to open the document in Office. MORE INFORMATIONThe following file is available for download from the Microsoft
Download Center. Click the file name below to download the file: Dsofile.exeRelease Date: Mar-24-1999 For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center.
You have a royalty-free right to use, modify, reproduce and distribute the Dsofile.dll and Visual Basic Sample Application (and/or any modified version) in any way you find useful, provided that you agree that Microsoft has no warranty, obligations or liability for these files. NOTE: THE DSOFILE.DLL AND ASSOCIATED VISUAL BASIC SAMPLE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. Document PropertiesEvery OLE compound document has the ability to store additional information about the document in persistent property sets, collectively called the Document Summary Properties. These property sets are managed by COM/OLE so third-party clients can read this information without the aid of the main application responsible for the file.To aid developers interested in reading document properties, Microsoft has provided two interfaces to manage property sets: IPropertySetStorage and IPropertyStorage. However, Visual Basic programmers cannot use these interfaces directly because the interfaces are not Automation-compatible. To resolve this problem, Visual Basic developers can now use the included ActiveX DLL to read/write to the most common property sets used in OLE compound documents (particularly those used by Office applications). NOTE: Dsofile.dll uses IPropertySetStorage and IPropertyStorage internally. These interfaces were defined after the initial release of Windows 95, so Windows 95 users must have one of the following installed on their system for the DLL to work properly:
- or - OLE File Property ReaderDsofile.dll reads and writes to both standard and custom properties from any OLE Structured Storage file. This includes (but is not limited to) Word documents, Excel workbooks, and PowerPoint presentations. Due to its size and speed, the DLL can be much more efficient than trying to Automate Office to read document properties.To use the Property Reader, you need to register Dsofile.dll on your system (see below). Once registered, the component can be used by both late and early bound clients. To set an early bound reference in Visual Basic, use the References dialog (Project|References) and select the item: "DS: OLE Document Properties 1.0 Object Library." If the item is not listed in the dialog, use the Browse button to find the DLL. Dsofile.dll has only one creatable object, DSOleFile.PropertyReader. This object provides access to document properties through a single method, GetDocumentProperties. PropertyReader is a top level object and is marked GlobalMultiUse, so you do not need to explicitly create the object to use it. You can call GetDocumentProperties directly if you have already set a reference to the DLL in the References dialog. However, to save resources at run-time, it is recommended that you explicitly create and destroy a PropertyReader object when needed. If you allow Visual Basic to implicitly create the object, it will not be released until your application terminates. GetDocumentProperties takes the name of an OLE Structured Storage file and returns a DocumentProperties object that you can then Automate to read or modify property values. DocumentProperties provides access to the most common summary information used by Office applications. When the object is created, the specified file is open for exclusive access. If the file is in use by another application when you try to open it, you get a trappable error telling you that the file is locked. The DocumentProperties object contains a collection of the custom properties associated with the file. Each custom property has a unique name and is accessible in the collection by that name. You can add or remove individual properties and also enumerate through the entire collection using Visual Basic's For Each syntax. When calling GetDocumentProperties, the PropertyReader will first attempt to open the document for both read and write access. If the file has been marked read-only or is located on an NT share that provides just Read access, the PropertyReader will try to open the document in read access. When open for read-only, you cannot change values for any of the properties. To test whether the document is read-only, use the IsReadOnly method on the DocumentProperties object returned from GetDocumentProperties. The method returns True if the document is read-only. NOTE: Dsofile.dll was written specifically for use by Visual Basic programmers, but it can be used from any COM-aware language. In addition to the standard Automation errors, Dsofile.dll can return one of the following custom error messages when something goes wrong:
Another common error is: which occurs when attempting to modify a property in a read-only document. Steps to Setup and Test the DLLIncluded is a Visual Basic sample application that demonstrates using the Dsofile.dll to read and write document properties. Before you can run the sample you need to do the following:
REFERENCESFor information on how to read Document Properties from Visual C++, see the following article in the Microsoft Knowledge Base: Q186898 HOWTO: Read Compound Document Properties Directly with VC++ © Microsoft Corporation 1999, All Rights Reserved. Additional query words:
Keywords : kbfile kbole kbActiveX kbAutomation kbExcel kbPersistSt kbPowerPt kbWord kbGrpDSO |
Last Reviewed: December 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |