We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error when loading mhtml document

Hello,

I have an mhtml file that I tried to load using aspose words and it throws the following error:
The document appears to be corrupted and cannot be loaded. Unexpected format of MIME heading. Special chars in parameter name.

Here is sample code and attached are sample files:

    public void Test()
    {
        try
        {
            var good = @"d:\input\good.MHTML";
            var bad = @"d:\input\bad.MHTML";

            var d1 = new Aspose.Words.Document(good);
            var d2 = new Aspose.Words.Document(bad); // throws an exception : The document appears to be corrupted and cannot be loaded.  Unexpected format of MIME heading. Special chars in parameter name.
        }
        catch(Exception ex)
        {
            Console.WriteLine(ex);
        }
    }

I modified the file that was not working and named it good, if you compare the two file you will see that top multi-part section is removed and content-transfer-encoding is changed from binary to 7bit, these changes fix the issue.

I am able to open the mhtml file in both MS word and internet explorer without issue is it a bug in the aspose code?

Thanks

Ed

Data.zip (3.7 KB)

@ejt66

We have tested the scenario and have 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-19336. 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-19336) have been fixed in this Aspose.Words for .NET 19.12 update and this Aspose.Words for Java 19.12 update.