Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active November 26, 2021 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/1e0865cd17e0d1af503d555c3d3ce497 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/1e0865cd17e0d1af503d555c3d3ce497 to your computer and use it in GitHub Desktop.
Convert Word Documents to HTML in Python
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)
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)
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