从 'SAXParseException: "No namespace defined for pic"' 恢复 .docx 文件

Recover .docx file from 'SAXParseException: "No namespace defined for pic"'

我无法打开存储在 USB 随身碟中的 .docx 文件。我收到以下错误并且 LibreOffice 无法打开文档:

File format error found at 
SAXParseException: "No namespace defined for pic"
SAXParseException: '[word/document.xml line 2]: Namespace prefix pic on txbx is not defined
', Stream 'word/document.xml', Line 2, Column 30767(row,col).

有什么方法可以恢复文件吗?

解压缩 .docx 文件。如果您不知道如何操作,请在此处查看:

https://superuser.com/a/1356829/707698

在解压后的目录中,找到word/document.xml文件,用文本编辑器打开。在第二行中,您会看到如下内容:

<w:document xmlns:o="urn:schemas-microsoft-com:office:office" 
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
xmlns:v="urn:schemas-microsoft-com:vml" 
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" 
xmlns:w10="urn:schemas-microsoft-com:office:word" 
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" 
xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" 
xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" 
xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" 
mc:Ignorable="w14 wp14">

您必须在该语句中包含以下属性:

xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"

之后你会得到这样的东西:

<w:document xmlns:o="urn:schemas-microsoft-com:office:office" 
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
xmlns:v="urn:schemas-microsoft-com:vml" 
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" 
xmlns:w10="urn:schemas-microsoft-com:office:word" 
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" 
xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" 
xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" 
xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" 
xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" 
mc:Ignorable="w14 wp14">

现在您只需要从解压目录重建.docx文件。如果您不知道如何操作,请在此处查看:

https://superuser.com/a/1356829/707698