Finally, a permanent solution
If you’re using Word 2007, 2010 or 2013, you might run into a strange error when opening a DOCX file. Recently, I tried to open a DOCX file I had created on Windows 10 using Office 2013 and got the following error message:
The name in the end tag of the element must match the element type in the start tag.
Hmm, no idea what that means! After doing a bit of research, I found that this error is related to the XML code that a DOCX file is actually made up of. Normally, this error will not result in the loss of your file or it’s contents, but it’s a good idea to make a copy of the file before you starting making any changes.
If you end up messing up the original file, you can always try again using the backup file. Here is what the error message looks like if you’re using Office 2013:
You’ll also see some extra info like Location: Part: /word/document.xml, Line: 2, Column: xxxx. So what causes this error? Apparently, it’s equations! Specifically, it’s related to oMath tags when an equation is anchored to the same paragraph as a text box or graphical object.
Luckily, there’s a straight-forward way to fix this error. I’ll start with the easiest and move on to the more technical solutions for those who are interested.
Microsoft has released a Fix-it download that will go ahead and repair the problematic Word file. Note that even though this will fix the issue temporarily, it may re-occur if you edit the file again. Scroll down to read about how you can prevent this error from occurring again.
Manually Edit XML
If you want to do this manually, you can open the DOCX file and edit the XML. However, I don’t really recommend this as it’s complicated and could mess up things even more. There is a way to adjust the actual Word document, which you can read down below.
Basically, the whole Word file is actually a zipped archive of a bunch of XML files. In order to see these files, you have to rename the extension from DOCX to ZIP.
In Windows 8/10, open Explorer and click on the View tab. On the right, you’ll see a checkbox called File name extensions. Go ahead and check that. Now rename the DOCX file to ZIP and double-click on it to open it.
Here you’ll see a couple of folders and an XML file. The main content of your Word document is inside the word folder. Open that and you’ll see one called document.xml.
That is the main XML which contains the content of your actual Word document. The other ones are just settings, styles, fonts, etc. Now opening this in Notepad will look like a mess, so you want to do a search for oMath because that’s the tag that causes problems. Basically, it should look like this:
If the first line <m:oMath> is somehow below or after lines two or three, then you’ll get this error. You need to move it back immediately above those lines to be able to open the Word file.
Permanent Fix for Start End Tag Error
Hopefully, the Fix-it tool resolved your problem, but it could occur again if you don’t fix the underlying cause permanently. To do that, all you have to do is update to Office 2010 or Office 2013 Service Pack 1. The issue is resolved in the service packs, so if you have not installed them, go ahead and do that.
Once installed, the problem will not occur with new files or with files that you manually fixed or fixed using Fix-it tool. If, for some reason, you are unable to update to SP 1, then there is one other solution which requires adjusting how the equation and text boxes are grouped in the Word document.
Once you have recovered your DOCX file using the tool or by manually editing the file, go ahead and open the Selection pane on the Home tab. You can get to it by click on the Select button first.
This will open a sidebar pane that lists out all the different objects on the page. Go ahead and press the CTRL key and select all the text boxes.
Once you have selected the text boxes, click on the Group button under Drawing Tools – Format – Arrange. It’s right next to the Select button I mentioned above.
That should group all your text boxes together. Now save your document and see if you can open it again without the error. This is a permanent solution, so even if you don’t upgrade to service pack 1, the error should go away. It definitely beats out editing XML files. If you have any questions, let us know in the comments. Enjoy!