Kevin Smith 0 Posted March 6, 2023 Hello, I'm trying to remove Word metadata using OLE. I can remove Author but I can't remove "Last author". I use following code: vEditor:= CreateOleObject('Word.Application'); vEditor.Visible:=True; vDoc:= vEditor.Documents.Open('sample.docx'); vDoc.BuiltInDocumentProperties.Item['Author']):= '';//It works! vDoc.BuiltInDocumentProperties.Item['Last Author']):= '';//It doesn't work vDoc.Save; vDoc.Close; vEditor.Quit; I hope you have some experience with such a task and you can help me. If there is other solution than using OLE please also give me an info. Share this post Link to post
PeterBelow 238 Posted March 6, 2023 5 minutes ago, Kevin Smith said: Hello, I'm trying to remove Word metadata using OLE. I can remove Author but I can't remove "Last author". I use following code: vEditor:= CreateOleObject('Word.Application'); vEditor.Visible:=True; vDoc:= vEditor.Documents.Open('sample.docx'); vDoc.BuiltInDocumentProperties.Item['Author']):= '';//It works! vDoc.BuiltInDocumentProperties.Item['Last Author']):= '';//It doesn't work vDoc.Save; vDoc.Close; vEditor.Quit; I hope you have some experience with such a task and you can help me. If there is other solution than using OLE please also give me an info. Isn't the Last Author set when the file is saved? That would simply undo your change... Share this post Link to post
Kevin Smith 0 Posted March 7, 2023 (edited) Quote Isn't the Last Author set when the file is saved? That would simply undo your change... Yes it looks like. Do you know how I can get rid of "Last author" property ? Edited March 7, 2023 by Kevin Smith Share this post Link to post
Lajos Juhász 293 Posted March 7, 2023 I believe you would have to do that in Word: (WINDOWS) Microsoft Word 2010, 2013, 2016: Go to “File” Select “Info” Click on “Check for issues” Click on “Inspect document” In the “Document Inspector” dialog box, select the check boxes to choose the types of hidden content that you want to be inspected. Click “Remove All” Click “Close” Save the document. Share this post Link to post
David Heffernan 2345 Posted March 7, 2023 (edited) Process the XML directly. Should actually be a really easy job for a SAX based processor. Even better, you don't need any COM automation of Word. If you need to do this in your product then I guess Delphi is best. If it's a helper script for personal use I'd do it in Python or similar. Edited March 7, 2023 by David Heffernan Share this post Link to post