Editing Word and Office Documents — in batch
Tuesday, October 23rd, 2007The file formats in Microsoft Office 2007 for Word, Excel, and PowerPoint (.docx, .xlsx, and .pptx, respectively) are based on ZIP technology. Just change the file extension to .zip, open in WinZip or a similar program and you expose the internals of the files. And presto, you have XML files (broken into a set of files and folders) that can be edited in Notebpad, or by a batch script, or any other means.
So, what does this mean for you, who need to efficiently manage your content in Word or other Office apps? You can edit, delete, add or verify information automatically for all files in a folder, for example, without opening individual documents.
Here is an example (from the user guide for Author Max™):
<dc:title>Author Max™ Toolbar Pro</dc:title>
<dc:subject>User guide</dc:subject>
So if I wanted to change the metadata field subject (doc property subject in Wordspeak) for many documents, I could write a script that looked in the core.xml file for all Word documents and presto make the change. (Of course, it might be simpler just to use Author Max™ to enforce rules for document properties and styles in the first place.)
Here’s another example, also taken from the Author Max documentation.
< ...w:val="center"/>© 2007 Method M Ltd. (All rights reserved)…
So if I wanted to change the footer for many documents to be left aligned, and the copyright year to be 2008, all that would be needed is to write a script that looked in the footer3.xml file for all Word documents and presto make the change. (Of course, it might be simpler just to use Author Max™ to enforce rules for headers and footers in the first place.) Need help implementing this or other Word functionality? Hey, that’s what our e-mail is for (info at methodm dot com).
Best wishes for clear, efficient and great writing!
Katriel