Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def part_class_selector(content_type, reltype):
PartFactory.part_type_for[CT.WML_NUMBERING] = NumberingPart
PartFactory.part_type_for[CT.WML_SETTINGS] = SettingsPart
PartFactory.part_type_for[CT.WML_STYLES] = StylesPart
PartFactory.part_type_for[CT.WML_DOCUMENT_MACRO_ENABLED_MAIN] = DocumentPart


del (
CT,
Expand Down
2 changes: 1 addition & 1 deletion docx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def Document(docx=None):
"""
docx = _default_docx_path() if docx is None else docx
document_part = Package.open(docx).main_document_part
if document_part.content_type != CT.WML_DOCUMENT_MAIN:
if document_part.content_type not in [CT.WML_DOCUMENT_MAIN, CT.WML_DOCUMENT_MACRO_ENABLED_MAIN]:
tmpl = "file '%s' is not a Word file, content type is '%s'"
raise ValueError(tmpl % (docx, document_part.content_type))
return document_part.document
Expand Down
1 change: 1 addition & 0 deletions docx/opc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ class CONTENT_TYPE(object):
'application/vnd.openxmlformats-officedocument.wordprocessingml.docu'
'ment.main+xml'
)
WML_DOCUMENT_MACRO_ENABLED_MAIN = ( 'application/vnd.ms-word.document.macroEnabled.main+xml' )
WML_ENDNOTES = (
'application/vnd.openxmlformats-officedocument.wordprocessingml.endn'
'otes+xml'
Expand Down