-
Notifications
You must be signed in to change notification settings - Fork 1.2k
added support for .docm files #716
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
base: master
Are you sure you want to change the base?
added support for .docm files #716
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of:
if document_part.content_type not in [CT.WML_DOCUMENT_MAIN, CT.WML_DOCUMENT_MACRO_ENABLED_MAIN]:
Why not:
if document_part.content_type not in {CT.WML_DOCUMENT_MAIN, CT.WML_DOCUMENT_MACRO_ENABLED_MAIN}:
I.e. change the collection type to a set
. I feel that it's just better practice when all you want to do is test for membership.
This would be great if this pull request be accepted as it is super simple & will avoid all of us that need to load .docm files to do dirty setups either by modifying your library locally or overloading it. |
I agree that it would be great if this gets merged, currently I use a script that uses soffice to convert |
@scanny Is there any blocking point preventing the acceptance of this pull request ? it seems to pass the checks. |
I'm looking forward to this PR as well! |
Hi, this is great! Can we get it merged asap please? |
I'm looking forward to this PR as well! |
Worked great for me when I implemented this patch on my own - able to work with docx and docm files without issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems OK
Works very nice. Macros are preserved after saving, everything is fine. |
Please merge :( |
Hello, It seems like there are some forks of python-docx just for this purpose, including one called "python-docx-docm". Turns out it doesn't work either as you get an error:
Because one line is missing (the modification of init.py in this MR). It can be monkey patched on-the-fly in the code, with this line of code:
With this modification, docm file can be opened with the "python-docx-docm" forks. But it would be best if this MR could be merged |
Any news on this being implemented? Seems like an easy issue. |
Why is this still not merged? |
A long lasting issue with python-docx has been the lack of support of macro-enabled files.
A patch has been created a long time ago but I was never merged in master branch.
It is identical approach as suggested in #673.