Board index » delphi » Identifying a MS Word Document with "Propeerties"

Identifying a MS Word Document with "Propeerties"


2004-08-12 01:02:35 PM
delphi59
I have number word documents in various folders with unique numebrs in "Properties/Title" field(entered through File/Properties/Summary.
I want to enter this number in a text box & search through the folder to access the file having the unique number in its Properties/Title field & copy it to another location given in another text box
How can i do this in delphi 8 through word automation
Thanks in advance
 
 

Re:Identifying a MS Word Document with "Propeerties"

Quote
I have number word documents in various folders with unique numebrs in
"Properties/Title" field(entered through File/Properties/Summary.
I want to enter this number in a text box & search through the folder to
access the file having the unique number in its Properties/Title field &
copy it to another location given in another text box
Quote
How can i do this in delphi 8 through word automation
I believe Mike has some components that allow you to access the properites
without opening word. If you did open word, then you could access the
following property to get the value:
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)
Oliver Townshend
 

Re:Identifying a MS Word Document with "Propeerties"

Is it possible to give some code in delphi 8 for finding the properties with out opening the document(since all the files in the folder have to be browsed through).Where are the word automation components in delphi 8?
Thanks
venkatesh
"Oliver Townshend" <oliver_at_zip_com_au>writes:
Quote
>I have number word documents in various folders with unique numebrs in
"Properties/Title" field(entered through File/Properties/Summary.
>I want to enter this number in a text box & search through the folder to
access the file having the unique number in its Properties/Title field &
copy it to another location given in another text box
>How can i do this in delphi 8 through word automation

I believe Mike has some components that allow you to access the properites
without opening word. If you did open word, then you could access the
following property to get the value:

ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)

Oliver Townshend


 

Re:Identifying a MS Word Document with "Propeerties"

Quote
Is it possible to give some code in delphi 8 for finding the properties
with out opening the document(since all the files in the folder have to be
browsed through).Where are the word automation components in delphi 8?
I don't know how to browse the the properties without opening the document
in word using Ole Automation (let alone doing it in Delphi 8 which is still
in its shrink wrap).
I suggest you check out the Word Document components at
www.scalabium.com/. These don't use OLE Automation, just a simple
component.
Oliver Townshend
 

Re:Identifying a MS Word Document with "Propeerties"

Venkatesh VT writes:
Quote
Is it possible to give some code in delphi 8 for finding the
properties with out opening the document(since all the files in the
folder have to be browsed through).Where are the word automation
components in delphi 8?
Word documents are Compound Files - a Windows implementation of
"structured storage files" - so their properties are accessible via the
IPropertyStorage and IPropertySetStorage interfaces described in MSDN.
Windows Explorer uses these interfaces to display the properties of a
compound file when you choose Properties from a file's context menu in
Explorer.
--
Regards,
Steve Moss,
CoCo Systems Ltd.
Delphi 6.02, Win2K + SP4
 

Re:Identifying a MS Word Document with "Propeerties"

How to access these properties from delphi 8.While i could find out how to do this in delphi 7,i dont know how to do this in delphi 8.For e.g how to execute the following code in delphi 8
CreateOLEObject does not work in delphi 8
Venkatesh
**********************************************
(Delphi 7 code works fine but not in delphi 8)
uses comobj;
procedure TForm1.Button1Click(Sender: TObject);
const
wdPropertyTitle = $00000001;
wdPropertySubject = $00000002;
wdPropertyAuthor = $00000003;
wdPropertyKeywords = $00000004;
wdPropertyComments = $00000005;
wdPropertyTemplate = $00000006;
wdPropertyLastAuthor = $00000007;
wdPropertyRevision = $00000008;
wdPropertyAppName = $00000009;
wdPropertyTimeLastPrinted = $0000000A;
wdPropertyTimeCreated = $0000000B;
wdPropertyTimeLastSaved = $0000000C;
wdPropertyVBATotalEdit = $0000000D;
wdPropertyPages = $0000000E;
wdPropertyWords = $0000000F;
wdPropertyCharacters = $00000010;
wdPropertySecurity = $00000011;
wdPropertyCategory = $00000012;
wdPropertyFormat = $00000013;
wdPropertyManager = $00000014;
wdPropertyCompany = $00000015;
wdPropertyBytes = $00000016;
wdPropertyLines = $00000017;
wdPropertyParas = $00000018;
wdPropertySlides = $00000019;
wdPropertyNotes = $0000001A;
wdPropertyHiddenSlides = $0000001B;
wdPropertyMMClips = $0000001C;
wdPropertyHyperlinkBase = $0000001D;
wdPropertyCharsWSpaces = $0000001E;
const
AWordDoc = 'C:\Test.doc';
wdSaveChanges = $FFFFFFFF;
var
WordApp: OLEVariant;
SaveChanges: OleVariant;
begin
try
WordApp := CreateOleObject('Word.Application');
except
// Error....
Exit;
end;
try
WordApp.Visible := False;
WordApp.Documents.Open(AWordDoc);
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyTitle].Value := 'Your
Title...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertySubject].Value := 'Your
Subject...';
// ...
// ...
finally
SaveChanges := wdSaveChanges;
WordApp.Quit(SaveChanges, EmptyParam, EmptyParam);
end;
end;
"Steve Moss" <XXXX@XXXXX.COM>writes:
Quote
Venkatesh VT writes:

>Is it possible to give some code in delphi 8 for finding the
>properties with out opening the document(since all the files in the
>folder have to be browsed through).Where are the word automation
>components in delphi 8?

Word documents are Compound Files - a Windows implementation of
"structured storage files" - so their properties are accessible via the
IPropertyStorage and IPropertySetStorage interfaces described in MSDN.
Windows Explorer uses these interfaces to display the properties of a
compound file when you choose Properties from a file's context menu in
Explorer.

--
Regards,
Steve Moss,
CoCo Systems Ltd.

Delphi 6.02, Win2K + SP4
 

Re:Identifying a MS Word Document with "Propeerties"

Venkatesh VT writes:
Quote
How to access these properties from delphi 8.While i could find out
how to do this in delphi 7,i dont know how to do this in delphi 8.For
e.g how to execute the following code in delphi 8

CreateOLEObject does not work in delphi 8
I can not comment on Delphi 8 as I don't have it, but what I referred you
to was the IPropertyStorage and IPropertySetStorage interfaces, which
are not part of Word automation. Look them up in MSDN.
--
Regards,
Steve Moss,
CoCo Systems Ltd.
Delphi 6.02, Win2K + SP4
 

Re:Identifying a MS Word Document with "Propeerties"

Presntly i am trying to learn interop & that is availble in delphi 8 .
I basically wnat to know the following
-What is the name of the dll/assemly that shoud be used for accessing Word properties.
-What is the equivalent of
WordApp := CreateOLEObject('Word.Application');
in delphi 8.
There are hardly any articles with interop & delphi.How does Borland expect users to develop in delphi 8 if there are not enough delphi related information on delphi 8
Thanks
Venkatesh
Quote
I can not comment on Delphi 8 as I don't have it, but what I referred you
to was the IPropertyStorage and IPropertySetStorage interfaces, which
are not part of Word automation. Look them up in MSDN.

--
Regards,
Steve Moss,
CoCo Systems Ltd.
-
Delphi 6.02, Win2K + SP4
 

Re:Identifying a MS Word Document with "Propeerties"

Quote
-What is the name of the dll/assemly that shoud be used for accessing Word
properties.
-What is the equivalent of
WordApp := CreateOLEObject('Word.Application');
in delphi 8.
There are hardly any articles with interop & delphi.How does Borland
expect users to develop in delphi 8 if there are not enough delphi related
information on delphi 8
Read the MSDN articles on OLE. And translate the code from C# or VB.Net to
Delphi. Almost certainly any code samples written in Delphi 3-7 to do OLE
Automation will work as well. Check Deborah's site for links and tutorials.
Borland have provided an excellent tool for what you want, but no detailed
manuals. If there documentation is like previous versions, you will
probably find a chapter on OLE Automation in the manuals.
Oliver Townshend