从'SAXParseException:“未为pic定义名称空间”中恢复.docx文件。

时间:2018-09-09 18:00:13

标签: docx libreoffice libreoffice-writer

我无法打开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).

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

1 个答案:

答案 0 :(得分:0)

解压缩.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