Last active
June 13, 2025 18:50
-
-
Save groupdocs-com-kb/b6390ba4c1a9eb24cedd7ed9fabc3d08 to your computer and use it in GitHub Desktop.
Convert DOCX to RTF using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-docx-to-rtf-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 | |
# 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 RTF format | |
convert_options = WordProcessingConvertOptions() | |
# Convert DOCX to RTF | |
converter.convert("output.rtf", 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