Convert DOTX to JSON Format via Java

On Premise Java API to convert DOTX to JSON without using Microsoft® Word or Microsoft® Excel

DOTX Conversion via C# .NET DOTX Conversion via C++ DOTX Conversion in Android Apps

 

Using Aspose.Total for Java, converting DOTX to JSON format is a straightforward two-step process. Aspose.Total for Java is a comprehensive suite of feature-rich document manipulation and conversion APIs that enable developers to quickly and easily convert documents from one format to another.

The first step is to export DOTX to HTML using Aspose.Words for Java. Aspose.Words for Java is a powerful document manipulation API that enables developers to create, edit, convert, and print documents in various formats, including DOTX. It provides a wide range of features, such as document creation, manipulation, and conversion, as well as support for a variety of document formats. With Aspose.Words for Java, developers can easily export DOTX to HTML.

The second step is to convert HTML to JSON using Aspose.Cells for Java. Aspose.Cells for Java is a powerful spreadsheet manipulation API that enables developers to create, edit, and convert spreadsheets in various formats, including HTML. It provides a wide range of features, such as spreadsheet creation, manipulation, and conversion, as well as support for a variety of spreadsheet formats. With Aspose.Cells for Java, developers can easily convert HTML to JSON.

By using Aspose.Total for Java, developers can quickly and easily convert DOTX to JSON format in just two steps. Aspose.Words for Java enables developers to export DOTX to HTML, and Aspose.Cells for Java enables developers to convert HTML to JSON. With Aspose.Total for Java, developers can easily manipulate and convert documents from one format to another.

Convert DOTX to JSON Format via Java

  1. Open DOTX file using Document class
  2. Convert DOTX to HTML by using Save method
  3. Load HTML document by using Workbook class
  4. Save the document to JSON format using Save method

Conversion Requirements

You can easily use Aspose.Total for Java directly from a Maven based project and include libraries in your pom.xml.

Alternatively, you can get a ZIP file from downloads .

// supports DOC, DOT, DOCX, DOCM, DOTX, DOTM, RTF, WordML, MOBI, ODT, and OTT input file formats
// load DOCX with an instance of Document
Document document = new Document("template.docx");
// call Save method while passing SaveFormat.HTML
document.save("html_output.html",SaveFormat.HTML);
// load the HTML file in an instance of Workbook
Workbook book = new Workbook("html_output.html");
// save HTML as JSON
book.save("output.json", SaveFormat.JSON);

Convert Protected DOTX to JSON Format via Java

Using the API, you can also open the password-protected document. If your input DOTX document is password protected, you cannot convert it to JSON format without using the password. The API allows you to open the encrypted document by passing the correct password in a LoadOptions object. The following code example shows how to try opening an encrypted document with a password:

// supports DOC, DOT, DOCX, DOCM, DOTX, and DOTM file formats
// load DOCX with an instance of Document
Document document = new Document("template.docx", new LoadOptions("MyPassword"));
// call Save method while passing SaveFormat.HTML
document.save("html_output.html",SaveFormat.HTML);
// load the HTML file in an instance of Workbook
Workbook book = new Workbook("html_output.html");
// save HTML as JSON
book.save("output.json", SaveFormat.JSON);

Convert DOTX to JSON in Range via Java

While you are converting DOTX to JSON, you can also set range to your output JSON format. In order to set the range, you can open the converted HTML using Workbook class, create a Range of data to be exported using Cells.createRange method, call JsonUtility.exportRangeToJson method with references of Range & ExportRangeToJsonOptions and write string JSON data to file via BufferedWriter.write method.

// supports DOC, DOT, DOCX, DOCM, DOTX, DOTM, RTF, WordML, MOBI, ODT, and OTT input file formats
// load DOCX with an instance of Document
Document document = new Document("template.docx");
// call Save method while passing SaveFormat.HTML
document.save("html_output.html",SaveFormat.HTML);
// load the HTML file in an instance of Workbook
Workbook book = new Workbook("html_output.html");
// access CellsCollection of the worksheet containing data to be converted
Cells cells = workbook.getWorksheets().get(0).getCells();
// create & set ExportRangeToJsonOptions for advanced options
ExportRangeToJsonOptions exportOptions = new ExportRangeToJsonOptions();
// create a range of cells containing data to be exported
Range range = cells.createRange(0, 0, cells.getLastCell().getRow() + 1, cells.getLastCell().getColumn() + 1);
// export range as JSON data
String jsonData = JsonUtility.exportRangeToJson(range, exportOptions);
// write data to disc in JSON format
BufferedWriter writer = new BufferedWriter(new FileWriter("output.json"));
writer.write(jsonData);
writer.close();

Explore DOTX Conversion Options with Java

Convert DOTX to EXCEL (Spreadsheet File Formats)
Convert DOTX to ODP (OpenDocument Presentation Format)
Convert DOTX to POT (Microsoft PowerPoint Template Files)
Convert DOTX to POTM (Microsoft PowerPoint Template File)
Convert DOTX to POTX (Microsoft PowerPoint Template Presentation)
Convert DOTX to PPTX (Open XML presentation Format)
Convert DOTX to PPS (PowerPoint Slide Show)
Convert DOTX to PPSM (Macro-enabled Slide Show)
Convert DOTX to PPSX (PowerPoint Slide Show)
Convert DOTX to PPT (PowerPoint Presentation)
Convert DOTX to PPTM (Macro-enabled Presentation File)
Convert DOTX to PPTX (Open XML presentation Format)
Convert DOTX to XLS (Microsoft Excel Binary Format)
Convert DOTX to XLSB (Excel Binary Workbook)
Convert DOTX to XLSM (Macro-enabled Spreadsheet)
Convert DOTX to XLSX (Open XML Workbook)
Convert DOTX to XLT (Excel 97 - 2003 Template)
Convert DOTX to XLTX (Excel Template)
Convert DOTX to CSV (Comma Seperated Values)
Convert DOTX to DIF (Data Interchange Format)
Convert DOTX to FODS (OpenDocument Flat XML Spreadsheet)
Convert DOTX to ODS (OpenDocument Spreadsheet)
Convert DOTX to SXC (StarOffice Calc Spreadsheet)
Convert DOTX to TSV (Tab-separated Values)
Convert DOTX to XLAM (Excel Macro-Enabled Add-In)
Convert DOTX to XLTM (Excel Macro-Enabled Template)