How to convert Microsoft Word document to HTML in JAVA with Aspose.Words REST API

Where can i find the documentation for the docx to html api in aspose ?
I need a java api for this process.

i found a link for the cloud api
Convert a document to another format|Aspose Words Cloud Docs
But iam looking for java api .calls
Can someone send me a link ?

Hi Kenadams,

There are two solutions.

1. You can download latest version of Aspose.Words for Java from https://downloads.aspose.com/words/java and use Convert to PDF example. Output format in this example is PDF but you can replace it with HTML to convert to HTML. You can also specify HTML save options as you can see at https://docs.aspose.com/display/wordsjava/Saving+a+Document#SavingaDocument-SpecifyingHTMLSaveOptions

2. If you want to use our Cloud APIs to convert to HTML, you can find the Java example on the same link you shared. There are several tabs in REST and SDK examples sections. You can select Java tab to see Java examples.

Please feel free to contact us in case you have further comments or questions.

Best Regards,

@vishnuj81093

Please note since Aspose.Words Cloud 19.4 we have introduced API Version V4.0. In this release, we have changed PUT API calls to POST (and vice versa) all idempotent methods are PUT and non-idempotent ones are POST. Please find sample Java code to convert DOCX to HTML.

// Get Client ID and Secret from https://dashboard.aspose.cloud/
WordsApi wordsApi = new WordsApi("xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","https://api.aspose.cloud");
	
ConvertDocumentRequest request = new ConvertDocumentRequest(
            Files.readAllBytes(Paths.get("C:/Temp/02_pages.docx").toAbsolutePath()),"html", null, null, null, null );

File result = wordsApi.convertDocument(request);
System.out.println("api request completed...");
File dest = new File("C:/Temp/02_pages_java.html");
Files.copy(result.toPath(), dest.toPath(),
java.nio.file.StandardCopyOption.REPLACE_EXISTING);