If you are using Word 2007, 2010 or 2013, you may encounter a strange error when opening a DOCX file. I recently tried to open a DOCX file that I created on Windows 10 using Office 2013 and I got the following error message:
The name in the end tag of an element must match the type of the element in the start tag.
Hmm, I have no idea what that means! After doing a little research, I discovered that this error is related to the XML that actually makes up the DOCX file. This error usually does not result in the loss of the file or its contents, but it is recommended that you make a copy of the file before you start making any changes.
If you mess up the original file, you can always try again using the backup file. This is what the error message looks like if you’re using Office 2013:
You will also see additional information such as Location: Part: /word/document.xml, Line: 2, Column: xxxx. So what is causing this error? Apparently these are equations! In particular, this has to do with oMath tags, where an equation is anchored to the same paragraph as a text box or graphic.
Fortunately, there is an easy way to fix this error. I will start with the simplest and move on to technical solutions for those who are interested.
Microsoft has released a Fix-it download that will help fix the problematic Word file. Note that even if this temporarily fixes the problem, it may reappear if you edit the file again. Scroll down to find out how to prevent this error from recurring.
Manually edit XML
If you want to do it manually, you can open the DOCX file and edit the XML. However, I do not recommend doing this, as it is difficult and can spoil the situation even more. There is a way to customize the actual Word document, which you can read about below.
Essentially, the entire Word file is a zipped archive from a bunch of XML files. To see these files, you need to rename the extension from DOCX to ZIP.
In Windows 8/10, open File Explorer and go to the View tab. On the right you will see a checkbox for File name extensions. Go ahead and check it out. Now rename the DOCX file to ZIP and double-click it to open it.
Here you will see a couple of folders and an XML file. The main content of your Word document is inside the Word folder. Open it and you will see a file called document.xml.
This is the main XML that contains the content of your actual Word document. The rest are just settings, styles, fonts, etc. Now opening this in Notepad will look messy, so you have to search on oMath because that is the tag that is causing the problem. It should basically look like this:
If the first line is somehow below or after the second or third lines, you will get this error. You need to move it directly above these lines so that the Word file can be opened.
Permanent fix for the error mark end start
Hopefully the Fix-it tool has resolved your problem, but it could come up again if you don’t fix the root cause permanently. To do this, all you have to do is upgrade to Office 2010 or Office 2013 Service Pack 1. The issue is fixed in Service Packs, so if you haven’t installed them, please do so.
Once installed, the problem will not occur with new files or files that you manually fix or fix using the Fix-it tool. If for some reason you are unable to upgrade to SP 1, then there is another solution that requires customizing the grouping of formulas and text boxes in the Word document.
After you have restored the DOCX file using this tool or manually edited the file, open the Select panel on the Home tab. You can navigate to it by first clicking the “Select” button.
This will open a sidebar that lists all the different objects on the page. Continue, press CTRL and select all text boxes.
Once you have selected the text boxes, click the Group button under Drawing Tools – Format – Arrange. It’s next to the Select button I mentioned above.
This should group all of your text boxes together. Now save the document and see if you can open it again without error. This is a permanent solution, so even if you don’t upgrade to SP1 the error should go away. It definitely beats editing XML files. If you have any questions, let us know in the comments. Enjoy!