Hi,
I am facing an issue when converting Html to Word (docx) documents using Aspose.Words nuget package version (19.11.0) in .Net application and the conversion process stops / hangs and does not resume unless the calling code ignores it or times out.
No error is thrown as the conversion process halts and does not recover.
I am using the following code to convert document(s):
var htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PreferredControlType = HtmlControlType.StructuredDocumentTag;
// Setting the Enconding
htmlLoadOptions.Encoding = Encoding.UTF8;
// Create a new class implementing IWarningCallback which collect any warnings produced during document save.
var callback = new HandleDocumentWarnings();
// We assign the callback to the appropriate save options class. In this case, we are going to save to Word
// so we create a HtmlLoadOptions class and assign the callback there.
htmlLoadOptions.WarningCallback = callback;
// Load the Html document into memory
var document = new Document(info.File, htmlLoadOptions);
foreach (Table table in document.GetChildNodes(NodeType.Table, true))
{
foreach (Row row in table.Rows)
{
row.RowFormat.AllowBreakAcrossPages = false;
}
}
info.File.Close();
// Convert the document to a different format and save to stream
var streamResult = new MemoryStream();
var options = SaveOptions.CreateSaveOptions(SaveFormat.Docx);
options.TempFolder = WorkingDirectory;
document.Save(streamResult, options);
streamResult.Position = 0;
return new ConvertedDoc() { Content = streamResult, CountPages = document.PageCount };
Can you please examine the data to check why this is the case as a lot of delay is being added due to such conversions that keep the calling process busy until it times out (usually after an hour of waiting). A sample file is attached for your reference to reproduce the issue.
Thanks.
sample1.zip (35.7 KB)