Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature: Add support for .dotx Word templates (#1532)#1537

Open
coderamaster wants to merge 1 commit intopython-openxml:masterfrom
coderamaster:fix/1532-dotx-template-support
Open

Feature: Add support for .dotx Word templates (#1532)#1537
coderamaster wants to merge 1 commit intopython-openxml:masterfrom
coderamaster:fix/1532-dotx-template-support

Conversation

@coderamaster
Copy link

Description

Fixes#1532.

Adds support for loading Word template files (.dotx) withpython-docx.Document().


Problem

Loading a.dotx file currently raises aValueError due to an unsupported content type. Even if bypassed, the part factory creates a genericPart instead ofDocumentPart, causing anAttributeError.


Solution

Treat.dotx templates the same as.docx documents, which matches the OOXML spec.

Changes:

  • Accept Word template main content type
  • Map template content type toDocumentPart
  • Add tests for.dotx loading

Testing

  • Added tests for.dotx files
  • Verified with a real template created in Microsoft Word
  • Confirmed.docx behavior remains unchanged

- Added WML_TEMPLATE_MAIN content type constant- Updated Document() to accept both .docx and .dotx files- Added part factory mapping for template content type- Added tests for .dotx template loading-Fixespython-openxml#1532
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ValueError when loading .dotx Word template – lack of native template support

1 participant

@coderamaster

[8]ページ先頭

©2009-2026 Movatter.jp