When the following code is ran to convert the html string "
· Reason for Referral" to RTF, the RTF comes out “· Reason for Referral”, which is not expected, and appears to be wrong.
This conversion error is causing my program to output RTF that appears corrupted with invalid data and characters. Please let me know if there is a setting that I am missing which will prevent this from happening. This is a critical bug for my software’s current release, that is to go out ASAP.
Thank you,
Jon Ediger
public string HtmlToRtf(string html)
{
ASPOSE_LicenseHandler.SetLicense();
string rtf;
var options = new LoadOptions(LoadFormat.Html, "", "");
using(var htmlStream = new MemoryStream(Encoding.UTF8.GetBytes(html)))
{
using(var rtfStream = new MemoryStream())
{
var doc = new Document(htmlStream, options);
doc.Save(rtfStream, new RtfSaveOptions
{
ExportCompactSize = true, SaveFormat = SaveFormat.Rtf
});
rtfStream.Position = 0;
var sr = new StreamReader(rtfStream);
rtf = sr.ReadToEnd();
}
}
return rtf;
}