Here’s a little known secret: .docx files created by Microsoft Office or Open Office aren’t just one file. They are container files that contain XML files and other files that makeup the Word document that you’ve created and saved. You can explore and extract the contents of a .docx file just like you would with a .zip archive. This is handy for a variety of tasks, including recovering data from a corrupted .docx file to extracting images and other media from a .docx. In this tutorial, I’ll show you an incredibly easy way to explore the contents of a .docx file.
Locate a .docx file on your hard drive. Note: If you haven’t already, you need to Configure Windows 7 to Display File Extensions.
Right-click the document and choose Rename.
Add the .zip extension to the filename. Leave the rest of the filename intact.
When Windows asks you:
If you change a file name extension, the file might become unstable. Are you sure you want to change it?
You’ll notice that the file’s icon will change to that of a compressed (zipped) folder. Double-click it to explore it.
You’ll now be viewing the contents of the .docx file. There will be a couple of folders here, including _rels, docProps and word. Most of the good stuff is in word.
If you want to edit any of the .xml files, you should extract a copy of the .xml file by dragging and dropping it to another folder, such as the desktop.
Use a program like Notepad.exe or Notepad++ to edit it in plain text.
Note: You can open and view .xml files without extracting them from the .docx file, but when you go to save the changes, you’ll have to do it outside of the archive anyway.
After you’ve made your changes to the .xml file, drag and drop the edited file from your deskop back into the folder it came from in the .docx folder.
When prompted, choose Copy and Replace.
When you are done fiddling around in the .docx file, go back and rename it again, but this time remove the .zip extension.
You can now open it in Word or Open Office.
So, now you know how to rummage around in a .docx file. Stay tuned for the next groovyPost, where I’ll show you some useful ways to edit .docx and .xml files manually.