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”

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”

  • Comments 38
  • Likes

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 http://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. 

Comments
  • Thank you for posting this, Brandon.

    Can you tell us - in xml terms - what the Fixit will do, and whether it will identify the location of the error(s)? Because, if someone has a document with several textboxes and equations it would be beneficial to know which one(s) may need attention if the FixIt has not been a complete success.

  • Hi Tony,

    Hopefully we will have a KB article for the FixIt soon and it will explain what it does in xml terms, but it will not give the location of the error with any context as it relates to content in the document.  

    The initial error message mentions the column, so you could go to that column specifically in the document.xml file after the FixIt has corrected the document and look for a clue as to what part of the document has the problem.  I could add this as another workaround when we get the FixIt published and update the blog if it will be helpful.

    Brandon

  • Thanks, Brandon. I look forward to the FixIt.

    Only the very dedicated and/or those with specialist software can locate column 500,000 (or 5,000,000 in the one I saw the other day) and then make sense of what they see. I will have to give this some thought :)

  • Hello, this is wan peng here. can you please email the document to my email address*address removed*

    thank you for your kinds

  • Hi Wan Peng,

    I sent the fixed document.  Let me know if you have anymore problems.

    Brandon

  • Brandon,

    Thanks for all the tips. I've tried most of the tips on the forums how to fix this type of issue but to no avail my file is still not fixed. I've tried running the FixIt as well as a Rebuilder tool. According to the rebuilder the problem in my document does not involve any Math problems. Please help! I can email you the file if you can take a look at it please. Thanks!

    My email:**address removed**

  • Brandon,

    when i opened a document, it said The file could not be found or The directory is not valid. i couldnt find the problem or how to open the file . i tried to open a copy but it said , the file couldnt be found. PLEASE HELP    ! thank you <3 gabby

  • Hey Gabrielle,

    Are you getting this message when using the FixIt article KB2528942 or is this just in general that you are seeing this behavior?

    Brandon

  • Hi Gabrielle, could you fix my document?

  • i also need help...i can't open my document, here is the link of my file: www.mediafire.com

    if someone managed to recover it, please email me at maimaicomputer@yahoo.com

    thanks in advance.

  • I'm having the same problems as Rhet. I ran the Fixit tool for the same error message about mismatching endtags and it said that the problem was not with omath tags even though I have a ton of equations in my document. I can email you the document from coldfiress16@gmail.com

  • Hi Brandon De, I emailed via this blog about the possibility of getting a Word 2010 doc fixed for an end tag error. Any luck with that?

    Thanks

  • Hi AcBoyd,

    Unfortunately, I haven't seen anything come in that you sent.  Would it be possible try the "Email blog author" option again?

    Brandon

  • Hi Brandon,

    I just emailed a new request, via the Email blog author, with a link to download the file.

    Many thanks.

  • Dear Brandon I don't know which part of my document.xml file has problem and i should fix it.

    may I have your Email?

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment