Learn how to convert Word documents to HTML using Python: https://blog.aspose.com/2021/11/01/convert-word-to-html-in-python/
Last active
November 26, 2021 05:39
-
-
Save aspose-com-gists/1e0865cd17e0d1af503d555c3d3ce497 to your computer and use it in GitHub Desktop.
Convert Word Documents to HTML in Python
This file contains 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 aspose.words as aw | |
# Load the document from disk | |
doc = aw.Document("Document.docx") | |
# Specify resource folder | |
saveOptions.export_font_resources = True | |
saveOptions.resource_folder = docs_base.artifacts_dir + "Resources" | |
saveOptions.resource_folder_alias = "http:#example.com/resources" | |
# Save the document as HTML | |
doc.save("Document.html", saveOptions) |
This file contains 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 aspose.words as aw | |
# Load the document from disk | |
doc = aw.Document("Document.docx") | |
# Enable round-trip information | |
saveOptions = aw.saving.HtmlSaveOptions() | |
saveOptions.export_roundtrip_information = True | |
# Save the document as HTML | |
doc.save("Document.html", saveOptions) |
This file contains 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 aspose.words as aw | |
# Load the document from disk | |
doc = aw.Document("Document.docx") | |
# Enable export of fonts | |
options = aw.saving.HtmlSaveOptions() | |
options.export_font_resources = True | |
# Save the document as HTML | |
doc.save("Document.html", options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment