当尝试用.dot打开python-docx文件时,我得到的是错误:
KeyError: "no relationship of type 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument' in collection"以下是有关的守则:
from docx import Document
document = Document('file.dot')这里的实际问题是什么?
发布于 2016-08-23 15:04:40
您是如何生成输入文件的?这里当您将文件保存为严格的Open文档时,这是一个关于类型的问题。试试标准的Word文档。
您可以使用opc-diag获得更多关于文件内部关系的信息。
opc browse <FILE> .rels试图修复坏文件的想法:
# Extract the bad file to a temporary folder
unzip <FILE> -d bad-file
# Repackage the extracted data to a new fresh file
opc repackage bad-file new-file.docx
# A diff of relationships
opc diff-item test.docx test-ok.docx .relshttps://stackoverflow.com/questions/39104325
复制相似问题