如果您使用的是Word 2007、2010或 2013,则在打开(Word 2007)DOCX文件时可能会遇到奇怪的错误。最近,我尝试使用Office 2013打开我在Windows 10上创建的(Windows 10)DOCX文件,并收到以下错误消息:
元素结束标记中的名称必须与开始标记中的元素类型匹配。(The name in the end tag of the element must match the element type in the start tag.)
嗯(Hmm),不知道什么意思!经过一番研究,我发现这个错误与DOCX文件实际组成的XML代码有关。通常(Normally),此错误不会导致文件或其内容丢失,但在开始进行任何更改之前制作文件副本是个好主意。
如果您最终弄乱了原始文件,您可以随时使用备份文件重试。如果您使用的是Office 2013 ,则错误消息如下所示:
您还会看到一些额外的信息,例如Location: Part: /word/document.xml, Line: 2, Column: xxxx。那么是什么导致了这个错误呢?显然,这是方程式!具体来说,当方程锚定到与文本框或图形对象相同的段落时,它与 oMath 标记相关。
幸运的是,有一种直接的方法可以解决此错误。我将从最简单的开始,然后为感兴趣的人提供更多技术解决方案。
微软修复它
微软已经发布了一个Fix-it 下载(Fix-it download ),它将继续修复有问题的Word文件。请注意,即使这会暂时解决问题,但如果您再次编辑文件,它可能会再次发生。向下滚动(Scroll)以了解如何防止此错误再次发生。
手动编辑 XML
如果您想手动执行此操作,您可以打开DOCX文件并编辑XML . 但是,我真的不推荐这个,因为它很复杂,可能会更糟。有一种方法可以调整实际的Word文档,您可以在下面阅读。
基本上,整个Word文件实际上是一堆XML文件的压缩存档。为了查看这些文件,您必须将扩展名从DOCX重命名为ZIP。
在Windows 8/10中,打开资源管理器(Explorer)并单击查看(View)选项卡。在右侧,您会看到一个名为File name extensions的复选框。继续检查。现在将DOCX文件重命名为ZIP并双击打开它。
在这里,您将看到几个文件夹和一个XML文件。Word文档的主要内容位于word文件夹中。打开它,您会看到一个名为document.xml的文件。
这是包含实际Word文档内容的主要XML 。其他的只是设置、样式、字体等。现在在记事本(Notepad)中打开它看起来很乱,所以你想搜索oMath,因为那是导致问题的标签。基本上,它应该是这样的:
<m:oMath>
<mc:AlternateContent>
<mc:Choice Requires=”wps”>
如果第一行以某种方式低于或在第二或第三行之后,那么您将收到此错误。您需要将其移回这些行的正上方才能打开Word文件。
永久修复(Fix)开始结束标签错误(Start End Tag Error)
希望Fix-it工具解决了您的问题,但如果您不永久修复根本原因,它可能会再次发生。为此,您只需更新到Office 2010或Office 2013 Service Pack 1。该问题已在服务包中解决,因此如果您尚未安装它们,请继续执行此操作。
安装后,新文件或您手动修复或使用 Fix-it 工具修复的文件不会出现问题。如果由于某种原因您无法更新到SP 1,那么还有另一种解决方案需要调整公式和文本框在Word文档中的分组方式。
使用该工具或手动编辑文件恢复DOCX文件后,继续并打开“主页”(Home)选项卡上的“选择(Selection)”窗格。您可以通过首先单击“选择(Select)”按钮来访问它。
这将打开一个侧边栏窗格,列出页面上所有不同的对象。继续并按CTRL键并选择所有文本框。
选择文本框后,单击绘图工具 - 格式 - 排列下的(Drawing Tools – Format – Arrange)组(Group)按钮。它就在我上面提到的“选择(Select)”按钮旁边。
这应该将所有文本框组合在一起。现在保存您的文档,看看您是否可以再次打开它而不会出现错误。这是一个永久的解决方案,因此即使您不升级到 Service Pack 1,错误也应该会消失。它绝对胜过编辑 XML 文件。如果您有任何问题,请在评论中告诉我们。享受!
Fix End Tag Start Tag Mismatch Error When Opening DOCX Files
If you’re υsing Word 2007, 2010 оr 2013, you might run intо a strange error when opening a DOCX file. Recently, I tried to орen a DOCX file I had created оn 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 Fix-it
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:
<m:oMath>
<mc:AlternateContent>
<mc:Choice Requires=”wps”>
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!