Aspose Words opening MHTML file fails

Please see the attached MHTML file which was created using Aspose.Email 1.2.0.0 from Exchange Outlook message (msg file)

When trying to use this lines of code in C#

var loptions = new LoadOptions();
loptions.LoadFormat = LoadFormat.Mhtml;
var msgDocument = new Document(“C:\Email Body.mht”, loptions);

I am using latest and greatest Aspose.Words library

the last line fails with message

Cannot access a closed file.

And here is full stack call of error


at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
at System.IO.FileStream.set_Position(Int64 value)
at Aspose.Words.Document.x5d95f5f98c940295(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document…ctor(String fileName, LoadOptions loadOptions)

Again please find MHT file in attached zip file.

Hi Vahram,


Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 10.7.0, I managed to reproduce this exception on my side. I have logged this issue in our bug tracking system. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for inconvenience.

Best Regards,

Thanks Awais !

Hi Vahram,


Mhtml file, you provided, is corrupted. So, Aspose.Words throws an exception during opening.

Nevertheless, the exception thrown is incorrect and it will be fixed before upcoming release at the end of February. Aspose.Words will throw UnsupportedFileFormatException for such files.

It seems, this corrupted file is generated by Aspose.Email. I will ask them to add a number of corresponding issue to the thread so you will be able to track it too.

Hi Vahram,


Please accept my apologies for your inconvenience.

I am a representative of Aspose.Email product family. As narrated by my fellow colleague, a problem has been detected in Aspose.Email for .NET component while converting messages to MHT. We have logged this issue in our tracking system for correction purposes. The ticket Id for your reference is NETWORKNET-33165.

Hi Vahram,


I have moved your thread to the Aspose.Email forum because your problem mainly concerns Aspose.Email component. Moreover, your shared archive (Body Email.zip) contains the output of the message conversion process. To correctly isolate the problem, we will require your input file for our review. Will it be possible for you to share the message file that produced the said output?

Looking forward to your positive response.
Regards,

Hi,

I was able to fix it, The problem is the MHTML file I was generating by saving Outlook MSG as MHTML using Aspose Network

And this corrupted MHTML is produced if I open MSG in non unicode mode. Problem solved by opening MSG in Unicode mode.

thanks anyways

Thank you for your response.


Glad to know that you are up and running again. Still, it would be of great help in correcting our product if you can share your sample with us.

The issues you have found earlier (filed as NETWORKNET-33165) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)