So, you are working on that important Final presentation for your college Marketing Course and after toiling for hours you find Microsoft Office’s Word will no longer open your file. When you do, you get a error box that (after clicking on the “Details>>>” box) looks like this:
Argggggh!!!!!!! Six hours of work down the drain, or so my wife thought.
So you may have tried Microsoft’s fix, but alas, that was a waste of time and hope. (Microsoft’s page on this error is here). So here is the simple solution to all your problems.
This is nothing more than an XML error. XML is eXtensible Markup Language, which is not really a language as a format (like HTML). Everything has to be enclosed in containers. Containers look like this:
Container is a “node”. A Node has a start tag <container> and an equivalent end tag with a slash </container>. The stuff after the start tag and the closing brace are attributes of the container node (type=”sample”). Now this is XML in its simplest form, where it gets tricky is multiple nesting of duplicate nodes. If this is confusing you, don’t worry, it really isn’t important.
1. Make a copy of the offending document.
2. Rename the file to badfile.zip. Now, if you use explorer to rename it, it won’t suffice if it keeps the .docx extension at the end of the file. You can go to DOS (cmd) and rename it. Go to your Start box and type “cmd” thusly:
Once you get the distinctive DOS style box, type “ren badfile.docx badfile.zip”, like so:
Now I recommend putting the file low in your directory path to avoid lots of cd (change directory) commands to get to the file. If you need help navigating to the directory your file is in, google “DOS commands”.
Now all Word 2007+ documents are really just zipped folders. Once you rename that file, the document icon should turn from a Word icon to a zip folder icon.
3. Now you can extract the contents of that folder by right clicking and selecting “Extract All…” and accept the default folder location (should be a folder called “BadData”).
4. Download an XML Editor. Free ones are available, but you will need one that will open the file even if the XML is malformed. Microsoft’s XML Editor won’t do that. The XML Editor in Visual Studio will if you have that program. If not, I have found that SynText’s SernaFree works well enough, although it is slow with large files. The key is you need an XML Editor that will open malformed XML and identify the errors it finds. Specifically, it will be missing end tags, that is the tags with the </NodeName>.
NOTE: On large files, some of these editors are SLLLLOOOOOWWWWW. Like you type a letter and it takes 20 seconds to show up slow, maybe even slower. You don’t have to do much here so be patient.
5. Navigate to the badfile folder and select the word directory. In that directory you will find the offending document.xml. Open the document in the XML Editor. Select the default template if prompted, and when it chokes on the error most editors will either open in edit mode or ask if you want to edit in a text editor.
Since the XML is malformed it will show on en entire line or two. Your error message told you what line and column the error is on. Most XML editors will tell you the exact error, like so:
6. Go to the spot of the error by either double clicking the error and get taken to the spot of the error or just by scrolling to the spot, There is normally a column counter somewhere on the bottom of the Editor. Some editors will show the location of the error by underlining the error area in red.
7. Now we need to insert the end tag so the XML is well formed. Normally the spot identified as the error is the end of the end tag that the editor expected the missing tag. So, if the error is at position 23213, so to that position and backup to the previous end tag. This is where you need to insert the missing end tag. The error message will say what the tag should be but usually omits the brackets and slash. So if the error said it is missing a v:textbox end tag, you need to insert a </v:textbox>
So, the line should look like this:
Now, I would recommend saving and re-opening the file after each fix. That way you can tell if it is working or not before you spend too much time. Also, it is important to make a copy of this document,xml file in case you foul it up terribly, you can start over.
Once all the errors are gone, the file should open in the XML Editor without having to resort to the text file editor.
Once this file looks like a real XML file again, you can fix the word document. Remember the word document is now a zip file. So, right click the good copy of document.xml and select “Copy”. Double click the zip folder, and navigate to the word folder. Once you are at the word folder, right click and select “paste”. It will ask you if you want to overwrite the file, you, of course say “Yes”.
Almost done. Now you just need to rename the file back to a docx name of your choosing, again use cmd (DOS) same as in step 2 and ren badfile.zip repaired.docx, or whatever you want to call the fixed file.
It should now open in Word. yippee.
If this is all too much, email me and maybe we can work something out.