Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert ODT to DOC using Java

Convert ODT to DOC using Java


This Gist provides the details on how to convert ODT to DOC using Aspose.Words Cloud SDK for Java.

So in order to perform the conversion, we are going to first upload the ODT file to cloud storage and convert the output to DOC format. The resultant file is also saved in cloud storage. For complete details, please visit Convert ODT to DOC using Java REST API.

ODT to DOC

Important Links

Home | Product Page | Docs | API Reference | Cloud Dashboard | Code Samples | Source Code | Blog | Free Support | Free Trial

// for more examples, please visit https://github.com/aspose-words-cloud/aspose-words-cloud-java
try
{
// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/
String clientId = "bbf94a2c-6d7e-4020-b4d2-b9809741374e";
String clientSecret = "1c9379bb7d701c26cc87e741a29987bb";
// create an object of WordsApi
WordsApi wordsApi = new WordsApi(clientId, clientSecret, null);
// read ODT file content from local drive
File file = new File("c://Users/TableDocument.odt");
// create file upload request
UploadFileRequest uploadRequest = new UploadFileRequest(Files.readAllBytes(file.toPath()), "input.odt", null);
// upload file to cloud storage
wordsApi.uploadFile(uploadRequest);
// create document conversion request object
GetDocumentWithFormatRequest request = new GetDocumentWithFormatRequest("input.odt", "DOC", "", "Internal","", "", "", "resultant.doc","");
// Call API to convert ODT to DOC format
wordsApi.getDocumentWithFormat(request);
// print success message
System.out.println("ODT sucessfully converted to DOC format !");
}catch(Exception ex)
{
System.out.println(ex.getStackTrace());
}
Learn how to Convert ODT to DOC using Java Cloud SDK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment