Error when opening a Word 2007 or 2010 document “The name in the end tag of the element must match the element type in the start tag”

We've recently noticed an issue where documents are becoming corrupt after making edits and saving the file.  There have been multiple forum threads related to this particular issue and the purpose of this blog is to try and give you some ideas for how to correct the problem.

The one disclaimer worth mentioning is that this is not a 100% fix for all corrupt documents, nor will it fix all documents that give you the specific error message noted below.  The idea is to try and give you some options for getting your document back to a state where you can make edits/changes.

Problem Description:

Opening a Word document gives you an error "The file <filename> cannot be opened because there are problems with the contents. 

The name in the end tag of the element must match the element type in the start tag.  Location: Part: /word/document.xml, Line: 2, Column: 129414"

 

If you came to this blog from the FixIt KB article https://support.microsoft.com/kb/2528942, you can use the steps below to try and edit the document so that the issue does not keep re-occurring when you make more edits to the document and save the file.  After running the FixIt you should be able open the document in Word without getting an error message.   

The problem however, still remains in the structure of the document. Typically it's somewhere in an equation or a textbox.  If you make any edit to the document that doesn't correct the behavior and you save the document, you will end up with the document still giving you the error message.  It's important to keep in mind that the FixIt solution won't prevent the problem from re-occurring. It can only put the document into a state where Word will be able to open the document. 

Next, we get to the workarounds and if you didn't get to this blog post from the KB article, you can go to the article referenced above and run the FixIt solution to correct the document.  The KB article also has more information about this particular issue.  Once you have the document in a state where you can open it in Word, you can then proceed to the workarounds to try and correct the document.

Possible Workarounds:  

  1. Grouping objects.  These steps are done with Word 2010 in mind because the Selection Pane was introduced making it easier to see all the objects on the page and if you are using Word 2007 or earlier, it will be a little bit more difficult to select and group each individual object. 
    1. To start with, after opening the fixed document you will want to turn on the Selection pane.  This can be found in the Home tab of the ribbon.  In the Editing group of the Home tab, click the Select dropdown and then click Selection Pane... .
    2. This will open a task pane on the right side of the document and allow you to view the different objects on the currently active page.
    3. Hold CTRL and select each Text Box in the selection pane.
    4. Now we want to group all these objects together. Under Drawing Tools, on the Format tab, in the Arrange group, click Group, and then click Group.
    5. Once you have all objects grouped on each page, you can save the document with a new name.
  2. Save the document in the RTF file format.   This should work for Word 2007 and Word 2010.If the first workaround didn't work, you can try saving the document as an RTF file.  This method seems to consistently work in the example documents I've seen the exhibit the problem behavior.  It's not an ideal solution and the file sizes get quite large, but if you need to edit the file and can't find any other way of correcting the document, this might be your only option.
    1. After you open the document in Word, click  File  and then click Save (for Word 2007 click the Office Button  and then click Save As)
    2. In the Save As dialog, click on the Save as type: dropdown and select Rich Text Format (*.rtf) , then click Save.
      1. You could also save the document in the binary (.doc) format, but I've seen that the shapes tend to get moved around and shifted so they don't line up quite right so it's up to you if you want to use .doc or .rtf.
      2. Both can work, but rtf seems to be more consistent and have the least visual changes in the document.
  3. If you are running into problems where the steps above do not work, you can upload the file to an online share and send me the link.  I'm working on adjusting the FixIt solution so that it will fix the document and these manual steps will not be necessary, but until then you will have to rely on the KB article, this blog or some of the online forums for help getting the document fixed.

 

Lastly, there have been a lot of forum threads related to this particular problem and I would like to say a huge "Thank You!" to the MVP's and everyone else who has been helping people get their documents fixed.