Unknown File Format exception

Need to understand what I am doing wrong:
The following code is throwing an exception “Unknown file format.”, on theline:

Document doc = new Document(memoryStream);

Snippet of code:

ASPxHtmlEditor oEditor = (DevExpress.Web.ASPxHtmlEditor.ASPxHtmlEditor)oControl;
if (oEditor.Html.Length > 0)
{
    #region Convert HTML to RTF with Aspose.Words
    byte[] HTML = System.Text.Encoding.GetEncoding("iso-8859-1").GetBytes(oEditor.Html);
    System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(HTML);
    Document doc = new Document(memoryStream);
    RtfSaveOptions options = new RtfSaveOptions();
    MemoryStream dstStream = new MemoryStream();
    doc.Save(dstStream, options);
    dstStream.Position = 0;
    StreamReader reader = new StreamReader(dstStream);
    sText = reader.ReadToEnd();
    Utils.Log(String.Format("RTF: {0}", sText), Utils.LogCategory.DEBUG);
    #endregion
}

Hi
Thanks for your request. I think, in your case, you can explicitly specify load format:
https://reference.aspose.com/words/net/aspose.words/document/

LoadOptions options = new LoadOptions(Aspose.Words.LoadFormat.Html, "", "");
Document doc = new Document(stream, options);

Hope this helps.
Best regards,