DOCX to HTML Conversion using .NET | System.InvalidOperationException

Hi!

We are trying to convert the docx file attached to html using the following code:

var docxInputFilePath = @"...";
var outputHtmlFilePath = @"...";

AsposeLicenser.LoadLicense();

var saveOptions = new HtmlSaveOptions
{
    SaveFormat = SaveFormat.Html,
    CssStyleSheetType = CssStyleSheetType.Inline,
    ExportImagesAsBase64 = true,
    ExportFontsAsBase64 = true,
    PrettyFormat = true,
    Encoding = Encoding.UTF8,
    ExportPageSetup = true,
    ExportPageMargins = true,
    ExportRoundtripInformation = false
};

var docxDocument = new Document(docxInputFilePath);
docxDocument.JoinRunsWithSameFormatting();

docxDocument.Save(outputHtmlFilePath, saveOptions);

Aspose.Words throws System.InvalidOperationException: ‘Cannot remove because there is no parent.’ from the Save(…) call. Tried with 21.5.0 and 21.6.0, same results.

isolated.zip (27.4 KB)

Thanks for any help,
Arnold

@arnoldbeilandevozon

We have tested the scenario and managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-22406. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-22406) have been fixed in this Aspose.Words for .NET 21.12 update also available on NuGet.