Read the complete article on how to convert Word to JSON in Python: https://blog.aspose.com
Created
August 11, 2022 07:06
-
-
Save aspose-com-gists/86b958527aa90c096b44a7788b088607 to your computer and use it in GitHub Desktop.
Convert Word to JSON 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
# Load protected document using LoadOptions | |
doc = aw.Document("protected_doc.docx", aw.loading.LoadOptions("MyPassword")) | |
# Save document in HTML format | |
doc.save("html_output.html", aw.SaveFormat.HTML) | |
# Load the HTML file in an instance of Workbook class | |
book = Workbook("html_output.html") | |
# Save as JSON | |
book.save("word-to-json.json", SaveFormat.JSON) |
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
# Load document | |
doc = aw.Document("document1.docx") | |
# Save document in HTML format | |
doc.save("html_output.html", aw.SaveFormat.HTML) | |
# Load the HTML file in an instance of Workbook class | |
book = Workbook("html_output.html") | |
# Save as JSON | |
book.save("word-to-json.json", SaveFormat.JSON) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment