i write small code to update CustomDocumentProperties.
but after save the file and quit. the prop dose not saved as part of the document? is it possible? if so? what is the right way to do it?
Thanks for advance.
Var
Doc : OleVariant;
DocProps : OleVariant;
Item : OleVariant;
i : integer;
Value : string;
SaveChanges: OleVariant;
begin
Memo1.Lines.Clear;
WordApplication1.Connect;
WordApplication1.Visible := false;
WordApplication1.Documents.Open(Edit1.Text, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam);
Doc := WordApplication1.ActiveDocument;
DocProps := Doc.CustomDocumentProperties;
DocProps.Add(
'MyOpinionOfThisDocument2',
False, msoPropertyTypeString,
'Utter drivel', EmptyParam);
DocProps.Add(
'Mz_Ident2',
False, msoPropertyTypeString,
'1997', EmptyParam);
for I := 1 to DocProps.Count do // Iterate
begin
Item := DocProps.Item[i];
Memo1.Lines.Add(Item.name + ' = ' + item.value);
end;
SaveChanges := wdSaveChanges;
WordApplication1.Quit(SaveChanges, EmptyParam, EmptyParam);
WordApplication1.Disconnect;
end;