Convert ODT to DOC using Java API | ODT to Word Conversion Online

The Open Office Document (ODT) files are usually generated by Apache OpenOffice Writer and LibreOffice Writer. They are similar to DOC, DOCX, etc files generated by MS Word, and Google Docs. However, you may notice formatting differences and some Word features aren’t available in .odt files and Word documents (DOC) are compatible with most applications. So in this article, we are going to discuss the details on how to convert ODT to DOC using Java SDK.

DOC Conversion API

Aspose.Words Cloud SDK for Java enables you to create, edit and transform OpenOffice and MS Word files to various supported file formats. So in order to convert ODT to DOC format, we need to first install the SDK while adding the following information in pom.xml of the maven build type.

        <name>Aspose Java API</name>


After the installation, we need to create a free account by visiting Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up and obtain your client credentials.

Convert ODT to DOC in Java

Please follow the instructions specified below to convert ODF to DOC format using Java SDK.

  • Create an instance of WordsApi where we provide Client ID and Client Secret as parameters
  • Secondly, read the content of the ODT file from the local drive into the File object
  • Thirdly, create an object of UploadFileRequest and pass the File object and cloud storage path as arguments
  • Now call uploadFile(…) method to upload the ODT file to cloud storage
  • Then in order to convert ODT to DOC, we need to create an object of GetDocumentWithFormatRequest where we specify the output format as DOC
  • Finally, call the method getDocumentWithFormat(…) to perform the conversion

ODT to Word using cURL Commands

We know that REST APIs can be accessed via cURL commands, so in this section, we are going to use the cURL commands to load the ODT file from cloud storage, convert it to DOC format, and save the output to the same cloud storage. However, the pre-requisite is to generate a JWT token based on client credentials. So please execute the following command in the terminal application to generate the JWT token.

curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now we need to execute the following command to perform the conversion of ODT to Word format.

curl -v -X GET "https://api.aspose.cloud/v4.0/words/input.odt?format=DOC&outPath=resultant.doc" \
-H  "accept: application/octet-stream" \
-H  "Authorization: Bearer <JWT Token>"


In this article, we have discussed the details on how to convert ODT to DOC format using Java REST API. At the same time, we have learned the steps to convert ODT to Word format using cURL commands. Please note that the API is capable of performing various other amazing operations and their details can be found in the product documentation. In case you face any issues while using the API, please feel free to contact us through the technical support forum.

We highly recommend visiting the following links to learn about: