Title: ValueError when loading .dotx Word template – lack of native template support · Issue #1532 · python-openxml/python-docx · GitHub
Open Graph Title: ValueError when loading .dotx Word template – lack of native template support · Issue #1532 · python-openxml/python-docx
X Title: ValueError when loading .dotx Word template – lack of native template support · Issue #1532 · python-openxml/python-docx
Description: Attempting to instantiate a Word template (.dotx) using python-docx.Document() fails with a ValueError. The file opens normally in Microsoft Word and conforms to the standard OOXML template structure. Steps to Reproduce from docx import ...
Open Graph Description: Attempting to instantiate a Word template (.dotx) using python-docx.Document() fails with a ValueError. The file opens normally in Microsoft Word and conforms to the standard OOXML template structu...
X Description: Attempting to instantiate a Word template (.dotx) using python-docx.Document() fails with a ValueError. The file opens normally in Microsoft Word and conforms to the standard OOXML template structu...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/1532
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ValueError when loading .dotx Word template – lack of native template support","articleBody":"Attempting to instantiate a Word template (.dotx) using python-docx.Document() fails with a ValueError. The file opens normally in Microsoft Word and conforms to the standard OOXML template structure.\n\nSteps to Reproduce\n\nfrom docx import Document\ndoc = Document(\"\u003cdocname\u003e.dotx\")\n\n\nActual Behavior\n\nValueError: file '\u003cdocname\u003e.dotx' is not a Word file,\ncontent type is 'application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml'\n\n\nExpected Behavior\nThe library should be able to load .dotx templates just like .docx documents, allowing developers to:\n\nRead and apply existing style definitions\n\nRetain header/footer content, watermarks, and embedded assets\n\nSave new .docx files that preserve template formatting\n\nEnvironment\n\npython-docx version: (run pip show python-docx to confirm)\n\nPython version: 3.11+\n\nPlatform: Linux/Windows\n\nUse Case\nCorporate document generation workflows (e.g., Alignment Guard Labs) depend on .dotx templates for visual standards and branding. The current limitation forces manual template application in Word post-generation.\n\nProposed Enhancement\nAdd native .dotx support or a helper API such as Document.from_template(path) to copy all style and part relationships into a new .docx.","author":{"url":"https://github.com/furrepanther","@type":"Person","name":"furrepanther"},"datePublished":"2025-11-12T04:54:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1532/python-docx/issues/1532"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:53058d7d-25df-7014-46eb-d3a4d39e0535 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AADA:313B26:72F7C4:993101:69719E85 |
| html-safe-nonce | 6cc4818bf89cde85d78a4746a6ad3f788907789f0b8045cd734dcc5a376da348 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQURBOjMxM0IyNjo3MkY3QzQ6OTkzMTAxOjY5NzE5RTg1IiwidmlzaXRvcl9pZCI6IjY5MjYyODUwMTE3MzI3NjYzNDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c4c236817eced262a360ff1f240eab2382d1812dc5d63d9b01edda0c20ec4662 |
| hovercard-subject-tag | issue:3614904921 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openxml/python-docx/1532/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1c0529eb0b496793f68e4419de0ac9a841aee73c32e5d2393e44c32739c31ef1/python-openxml/python-docx/issues/1532 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1c0529eb0b496793f68e4419de0ac9a841aee73c32e5d2393e44c32739c31ef1/python-openxml/python-docx/issues/1532 |
| og:image:alt | Attempting to instantiate a Word template (.dotx) using python-docx.Document() fails with a ValueError. The file opens normally in Microsoft Word and conforms to the standard OOXML template structu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | furrepanther |
| hostname | github.com |
| expected-hostname | github.com |
| None | fdfdce9cd4f6ab85dca2b0d11264270829297c962dd5a79df449062d7822258f |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openxml/python-docx git https://github.com/python-openxml/python-docx.git |
| octolytics-dimension-user_id | 3403760 |
| octolytics-dimension-user_login | python-openxml |
| octolytics-dimension-repository_id | 13592924 |
| octolytics-dimension-repository_nwo | python-openxml/python-docx |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 13592924 |
| octolytics-dimension-repository_network_root_nwo | python-openxml/python-docx |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 51c736e60b302bd039c9d5164573d176ceb24bb2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width