Fran59
Guest
|
Hello,
I try to read and write document properties in word,
but I can not compile in Delphi ,
I have a syntax error , but I don't find the good syntax. Can someone help me ?
Here my code,
var
ASubject : string;
begin
ASubject := WordApp.ActiveDocument.CustomDocumentProperties(wdPropertySubject).Value;
end;
Thanks very much in advance for your help
Regards,
Fran?ois |
|
Fran59
Guest
|
Hello,
I finally solve it :
I hope it could help someone in the future, here the solution I found.
First thing, I had to use 'BuiltInDocumentProperties' instead 'CustomDocumentProperties'.
In fact the problem is the 'BuiltInDocumentProperties' is an 'IDispatch', so I solve it using an OleVariant.
And I add to use '[' instead of '('.
(finally, I sleep some hours , perhaps it helps too ;-) )
var
ASubject : string;
ADoc : oleVariant;
begin
ADoc := WordApp.ActiveDocument;
ASubject := ADoc.BuiltInDocumentProperties[wdPropertySubject].Value;
end;
|
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Hello,
Thank you for posting this. You are right, CustomDocumentProperties and BuiltInDocumentProperties collections contain different sets of properties and you use one or anothe depending on your business logic.
Andrei Smolin
Add-in Express Team Leader |
|