Aspose.Total for C++ is a comprehensive suite of APIs that enables developers to easily convert WORD documents to JSON format within their C++ applications. The process involves two steps. Firstly, Aspose.Words for C++ is used to export the WORD document to HTML. This API provides a wide range of features to manipulate WORD documents, such as creating, editing, and converting documents. After that, Aspose.Cells for C++ is used to convert the HTML to JSON format. This API provides a comprehensive set of features to work with spreadsheets, such as creating, editing, and converting spreadsheets.
The combination of Aspose.Words for C++ and Aspose.Cells for C++ makes it easy to convert WORD documents to JSON format. The APIs are designed to be easy to use and provide a wide range of features to manipulate documents and spreadsheets. Furthermore, the APIs are highly reliable and provide excellent performance. With Aspose.Total for C++, developers can quickly and easily convert WORD documents to JSON format within their C++ applications.
Convert WORD to JSON Format via C++
Get Started with C++ File Automation APIs
Install via Package Manager Console of Visual Studio with Install-Package Aspose.Total.Cpp
.
Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads .
// supports DOC, DOT, DOCX, DOCM, DOTX, DOTM, RTF, WordML, MOBI, ODT, and OTT file formats | |
// load DOCX as input file format with an instance of Document class | |
auto doc = MakeObject<Document>(u"Input.docx"); | |
// save document in HTML format | |
doc->Save(u"Output.html"); | |
// Load the HTML. | |
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"Output.html"); | |
// Save in JSON format. | |
wkb->Save(u"Output.json", SaveFormat_Json); |
Convert Protected WORD to JSON Format via C++
Using the API, you can also open the password-protected document. If your input WORD document is password protected, you cannot convert it to JSON format without using the password. To do this, use a special constructor overload, which accepts a LoadOptions object. This object contains the Password property, which specifies the password string.
// supports DOC, DOT, DOCX, DOCM, DOTX, DOTM, RTF, WordML, MOBI, ODT, and OTT file formats | |
// Loads encrypted document. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(u"LoadEncrypted.docx", System::MakeObject<LoadOptions>(u"aspose")); | |
// save document in HTML format | |
doc->Save(u"Output.html"); | |
// Load the HTML. | |
intrusive_ptr<Aspose::Cells::IWorkbook> wkb = Factory::CreateIWorkbook(u"Output.html"); | |
// Save in JSON format. | |
wkb->Save(u"Output.json", SaveFormat_Json); |