My coworker tried to convert all the docm files on our server to docx files by simply renaming them, however this corrupts the files. The only way to open them is by renaming them to docm then opening with word and selecting disable macros. is there any way to delete all macros from a docm file and convert it to a docx in python?
I was expecting to just remove all the VBAs and instances and references of a VBA of the doc by renaming it to a zip, however that still doesnt let me open it.
Spire.Doc for Python provides the capabilities to remove macros from .docm files and convert them to .docx format. But note it dosn't support creating or executing macros.
You can install it using this pip command:
Here is an example that removes macros from a .docm file and save it to a .docx file: