Last active
June 20, 2025 09:51
-
-
Save groupdocs-com-kb/37d0cabb68d1984b42658333988bb030 to your computer and use it in GitHub Desktop.
Convert DOCX to DOCM using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-docx-to-docm-using-python/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from groupdocs.conversion import License, Converter | |
from groupdocs.conversion.options.convert import WordProcessingConvertOptions | |
from groupdocs.conversion.filetypes import WordProcessingFileType | |
# If you have a license, uncomment the following lines to set it | |
# license_path = os.path.abspath("./GroupDocs.Conversion.lic") | |
# if os.path.exists(license_path): | |
# # Create License and set the path | |
# license = License() | |
# license.set_license(license_path) | |
# Load the source DOCX file | |
converter = Converter("input.docx") | |
# Set conversion options for DOCM format | |
convert_options = WordProcessingConvertOptions() | |
convert_options.format = WordProcessingFileType.DOCM | |
# Convert DOCX to DOCM | |
converter.convert("output.docm", convert_options) | |
# Print success message | |
print("Conversion completed successfully.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment