Error converting Word to HTML

Hi, I’m getting this error: Value cannot be null. (Parameter ‘image’) trying to convert a Word to HTML using the following function(error in document.Save):

[HttpPost("convert-word-to-html")]
public async Task<IActionResult> ConvertWordToHTML(IFormFile file)
{
    if (file == null || file.Length == 0)
    {
        return BadRequest("Please upload a valid Word file.");
    }
    try
    {
        using (var stream = new MemoryStream())
        {
            await file.CopyToAsync(stream);
            stream.Position = 0;

            ComponentInfo.SetLicense(ImportUtils.gemBoxSerialKey);
            ComponentInfo.FreeLimitReached += (sender, e) => e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial;

            var document = DocumentModel.Load(stream);

            CapturerByText capturer = new CapturerByText(document, null);

            // Convert the document to HTML string
            var saveOptions = new HtmlSaveOptions()
            {
                HtmlType = HtmlType.HtmlInline,
                EmbedImages = true,
                UseSemanticElements = false
            };

            string htmlName = "Exported.html";

            // Save DocumentModel object to HTML (or MHTML) file.
            document.Save(htmlName, saveOptions);

            // Returns the content of Exported.html and then remove the file
            var htmlContent = System.IO.File.ReadAllText(htmlName);
            System.IO.File.Delete(htmlName);

            return Ok(new { html = htmlContent, hasHeadingStyles = capturer.hasHeadingStyles(), stylesFromDoc = capturer.getStylesFromDoc() });
        }
    }
    catch (Exception ex)
    {
        return BadRequest(ex.Message);
    }
}

Could you guide me on what I should check in the Word file?

Hi Mirel,

Can you please send us your Word file so we can reproduce this issue and investigate it?
You can send it via email or support ticket, see our Contact page.

Regards,
Mario