forked from python-openxml/python-docx
-
Notifications
You must be signed in to change notification settings - Fork 0
Phase D.24: .docm macro-enabled file support #37
Copy link
Copy link
Open
Labels
Description
Support opening and saving .docm (macro-enabled) Word files without stripping macros.
Current behavior
Opening a .docm and saving it strips the VBA project because python-docx doesn't preserve the vbaProject.bin part.
API Design
- Document(path) — auto-detect .docm and preserve macro parts
- document.save('output.docm') — save with macros preserved
- document.has_macros — bool indicating if VBA project is present
Implementation
- Preserve the vbaProject.bin binary part and its relationship during round-trip
- Use correct content type for .docm: application/vnd.ms-word.document.macroEnabled.12
- Don't modify or parse the VBA part — just preserve it
Upstream: python-openxml#284, python-openxml#716 (29+16 = 45 comments)
Reactions are currently unavailable