added support for .docm files#716
added support for .docm files#716EmanueleCannizzaro wants to merge 2 commits intopython-openxml:masterfrom
Conversation
mfreeborn
left a comment
There was a problem hiding this comment.
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. |
|
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? |
|
Any news on that? If we want only to change the body of the document and not the macros, it seems like a pretty good fix. |
|
Just adding that for my use cases this is PR would add a lot of value. Would be great to see it merged in! |
|
Hi @scanny, is there anything that can be done to to help this PR being merged? |
|
Hi @scanny . |
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.