Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active August 11, 2022 06:25
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/ef58fb6ce957c1db12c39b7c871ec81f to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ef58fb6ce957c1db12c39b7c871ec81f to your computer and use it in GitHub Desktop.
Convert Word to JSON in C# .NET
// Load DOC document
Document doc = new Document("document.doc");
// Save document in HTML format
doc.Save("html_output.html", Aspose.Words.SaveFormat.Html);
// Load the HTML file in an instance of Aspose.Cells.Workbook class
Workbook book = new Workbook("html_output.html");
// Save as JSON
book.Save("word-to-json.json", Aspose.Cells.SaveFormat.Json);
// Load password protected DOC document
Document doc = new Document("document.doc", new Aspose.Words.Loading.LoadOptions("mypassword"));
// Save document in HTML format
doc.Save("html_output.html", Aspose.Words.SaveFormat.Html);
// Load the HTML file in an instance of Aspose.Cells.Workbook class
Workbook book = new Workbook("html_output.html");
// Save as JSON
book.Save("word-to-json.json", Aspose.Cells.SaveFormat.Json);
// Load password protected Word document
Document doc = new Document("document.docx", new Aspose.Words.Loading.LoadOptions("mypassword"));
// Save document in HTML format
doc.Save("html_output.html", Aspose.Words.SaveFormat.Html);
// Load the HTML file in an instance of Aspose.Cells.Workbook class
Workbook book = new Workbook("html_output.html");
// Save as JSON
book.Save("word-to-json.json", Aspose.Cells.SaveFormat.Json);
// Load Word document
Document doc = new Document("document.docx");
// Save document in HTML format
doc.Save("html_output.html", Aspose.Words.SaveFormat.Html);
// Load the HTML file in an instance of Aspose.Cells.Workbook class
Workbook book = new Workbook("html_output.html");
// Save as JSON
book.Save("word-to-json.json", Aspose.Cells.SaveFormat.Json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment