How to Convert Microsoft Word DOC to HTML in Java Cloud API?

In overview, It describes it is possible to convert doc to html for cloud.

But, in Aspose.SDK, there doesn’t exist HTML format.(SaveFormat.HTML)
Also, in API Documents, there doesn’t exist sample for HTML format.
how can I convert doc to html for cloud ?
I want to use it using Java language.

Thanks in advance.

Hi Kim,

Yes, you can convert your Microsoft Word DOC to HTML. This feature was recently added and that is the reason it is not present in the Java SDK. You can use conversion example http://www.aspose.com/docs/display/wordscloud/Convert+Document+to+other+File+Format+Using+Storage to convert your documents to HTML. Just change the output format in the example to HTML instead of PDF.

Best Regards,

@YMin

As an update, please note we have introduced API Version v4.0. It is better than older versions in terms of structure and improved memory management. Please find the sample code to convert Microsoft Word DOC to HTML in Java using Aspose.Words Cloud SDK for Java; Word Document to HTML Converter API. Please let us know if you have any questions or suggestions in this regard.

Convert Word Document to HTML in Java

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import com.aspose.words.cloud.ApiClient;
import com.aspose.words.cloud.ApiException;
import com.aspose.words.cloud.api.WordsApi;
import com.aspose.words.cloud.model.requests.ConvertDocumentRequest;

public class ConvertDOCtoHTMLJava {

	public static void main(String[] args) throws IOException, ApiException {
		// TODO Auto-generated method stub
		// Get Client ID and Secret from https://dashboard.aspose.cloud/
		// Create an instance of Aspose.Word Cloud
		ApiClient apiClient = new ApiClient(/*clientId*/ "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx", /*clientSecret*/ "xxxxxxxxxxxxxxxxxxxxxxxxxx", "https://api.aspose.cloud");
		WordsApi wordsApi = new WordsApi(apiClient);
		apiClient.setConnectTimeout(12*60*1000);
		apiClient.setReadTimeout(12*60*1000);
		apiClient.setWriteTimeout(12*60*1000);
		
		String inputFile="C:/Temp/02_pages.doc";
		String outputFile="C:/Temp/02_pages_java.html";
		
		// Convert DOC to HTML
		byte[] requestDocument = Files.readAllBytes(Paths.get(inputFile).toAbsolutePath());
		ConvertDocumentRequest convertRequest = new ConvertDocumentRequest(requestDocument, "html", null, null, null, null);
		File convertDOCtoHTML = wordsApi.convertDocument(convertRequest);
		System.out.println("DOC to HTML conversion completed...");
	    
		// Save output HTML to local drive
		File dest = new File(outputFile);
		Files.copy(convertDOCtoHTML.toPath(), dest.toPath(),
		java.nio.file.StandardCopyOption.REPLACE_EXISTING);

	}

}