-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't open a .docx file #229
Comments
What application did you use to create 123.docx? And does it open up okay in Microsoft Word? That's an odd content type for it to have. It sounds like a Microsoft Office theme file, one that only contains color palettes and perhaps certain styles. |
The same issue here and I have used Microsoft office to create a name.docx |
@scanny, I have the same issue and the file opens perfectly fine in LibreOffice Writer, Microsoft Word online and Google Docs (after conversion).
I tried to view the XML file with Could it be because the version of Microsoft Word that was used to build the file was too old? |
The opc command should be:
It's odd for the file to end with .doc. Usually that means it's saved in the legacy pre-Word 2007 format. |
Does this library not work for the legacy Below are the results of running opc browse form_letter.doc \[Content_Types\].xml <?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\'?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Default Extension="xml" ContentType="application/xml"/>
<Override PartName="/theme/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
<Override PartName="/theme/theme/themeManager.xml" ContentType="application/vnd.openxmlformats-officedocument.themeManager+xml"/>
</Types> |
@scanny Sorry, I RTFM-d and
I converted the |
Glad you got it working :) |
Helps convert doc to docx. this code u may include in your script
DISCLAIMER: it will work only on linux(ubuntu ) |
where can I download the "soffice" binary for windows? |
The code is like this,
from docx import Document
from docx.shared import Inches
document=Document('123.docx')
but i get an error like this,
Traceback (most recent call last):
File "C:/Python27/myDocx.py", line 5, in
document=Document('123.docx')
File "C:\Python27\lib\site-packages\python_docx-0.8.5-py2.7.egg\docx\api.py", line 28, in Document
raise ValueError(tmpl % (docx, document_part.content_type))
ValueError: file '123.docx' is not a Word file, content type is 'application/vnd.openxmlformats-officedocument.themeManager+xml'
How to handle this problem?
The text was updated successfully, but these errors were encountered: