Aspose.Words for .NET 11.2.0 Error UnsupportedFileFormatException: Unknown file format

Error : Unknown file format.

Details : Aspose.Words.UnsupportedFileFormatException: Unknown file format.
at Aspose.Words.Document.x5d4db34d48fb3129(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document.x5d95f5f98c940295(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document..ctor(Stream stream, LoadOptions loadOptions)
at Platformplus.Interfaces.Word.WordDocument.SaveTextAsDoc(String FileName, String HTMLDocumentText, SaveFormat DocumentSaveFormat) in C:\Development\components\Platformplus.Class\Interfaces\WordInterface.vb:line 340
at Platformplus.ClientSendLetter.btnSaveLetter_Click(Object sender, EventArgs e) in C:\Development\platformplus\Controls\ClientSendLetter.ascx.vb:line 567

Target Site : Void x5d4db34d48fb3129(System.IO.Stream, Aspose.Words.LoadOptions)


Code
Dim Stream As New System.IO.MemoryStream(Text.ASCIIEncoding.Default.GetBytes(HTMLDocumentText))
Dim LoadOptions As New Aspose.Words.LoadOptions()
LoadOptions.LoadFormat = LoadFormat.Docx

Dim NewDoc As New Aspose.Words.Document(Stream, LoadOptions)

NewDoc.Save(FileName, DocumentSaveFormat)
Hi Andrew,

Thanks for your inquiry. Could you please attach your input Word document (.docx file), you're getting this exception with, here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,
All good I've changed the code to, I've attached doc:

Dim Stream As New System.IO.MemoryStream(Text.ASCIIEncoding.Default.GetBytes(HTMLDocumentText))
Dim NewDoc As New Aspose.Words.Document()
Dim DocBuilder As New Aspose.Words.DocumentBuilder(NewDoc)

DocBuilder.InsertHtml(HTMLDocumentText)

NewDoc.Save(FileName, DocumentSaveFormat)
Hi Andrew,

Thanks for the additional information.

Perhaps, you're using an older version of Aspose.Words; as with Aspose.Words v11.3.0, I was unable to reproduce this exception during loading test.docx file into Aspose.Words DOM. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.3.0 and let us know how it goes on your side.

I hope, this will help.

Best Regards,