Conversion from Html to Docx fails

var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead(htmlFilePath);
var convertRequest = new ConvertDocumentRequest(requestDocument, “docx”, @"C:\home\site\wwwroot", “testFile”);
var conversion = await wordsApi.ConvertDocument(convertRequest);

The file fails to convert from html to docx, Am i missing something ?

@Duminda

Please find below sample code for HTML to DOCX conversion. It will help you accomplish your requirements.

Aspose.Words.Cloud.Sdk.Configuration config = new Aspose.Words.Cloud.Sdk.Configuration();
config.ClientId = ClientId;
config.ClientSecret = ClientSecret;

WordsApi wordsApi = new WordsApi(config);

string localFile = @"C:\Temp\Test.html";

var requestDocument = File.OpenRead(localFile);
var convertRequest = new ConvertDocumentRequest(document: requestDocument,format: "docx");
var actual = await wordsApi.ConvertDocument(convertRequest);            
var fileStream = System.IO.File.Create(@"C:\Temp\output.docx");
actual.CopyTo(fileStream);
fileStream.Close();
1 Like

var convertRequest = new ConvertDocumentRequest(document: requestDocument, format: “docx”);
var actual = await wordsApi.ConvertDocument(convertRequest);
var fileStream = System.IO.File.Create(docFilePath);
actual.CopyTo(fileStream);
fileStream.Close();

This used to work now API call fails

@Duminda

The code is working fine on my side. Please ensure that you are using the latest version of Aspose.Words Cloud SDK for .NET and if the issue persists, then please share the error details (logs); we will look into it and guide you accordingly.