Free Support Forum - aspose.com

? Marks in HTML

Hi,

I'm using Aspose.Words for .NET 11.5.0.0 and when converting from RTF to HTML ? marks are being inserted. Are there configurations settings that would not place the ? in the HTML?

Here are the options we are using.

private HtmlSaveOptions getSaveOptions()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

{

HtmlSaveOptions saveOptions = new HtmlSaveOptions();

saveOptions.ExportHeadersFootersMode = ExportHeadersFootersMode.FirstSectionHeaderLastSectionFooter;

saveOptions.PrettyFormat = true;

saveOptions.UseHighQualityRendering = true;

saveOptions.TableWidthOutputMode = HtmlElementSizeOutputMode.All;

return saveOptions;

}

See the attached RTF and HTML

Thanks

Hi Tony,


Thanks for your inquiry.

I was unable to reproduce this issue on my side during exporting Rtf to Html. I would suggest you please upgrade to the latest version of Aspose.Words i.e. 11.9.0. You can download it from the following link:

I hope, this helps.

Best Regards,

Hi, I tried 11.9 with same results. Did you try an In-memory conversion using streams or a file based conversion and is there a difference with the charactes that apose would write to each? Here is how we are performing the conversion.

// In-memory conversion using Aspose.
private string ConvertRtfToHtml(string rtf)
{
byte[] rtfBytes = Encoding.ASCII.GetBytes(rtf);
using (var inStream = new MemoryStream(rtfBytes))
{
using (var outStream = new MemoryStream())
{
var asposeDoc = new Document(inStream); // Aspose
asposeDoc.Save(outStream, _htmlSaveOptions);
outStream.Position = 0;
using (var reader = new StreamReader(outStream))
{
return (reader.ReadToEnd());
}
}
}
}

Hi Tony,


Thanks for your inquiry. I tried both in-memory and direct rtf to html conversions on my side and was unable to reproduce this issue on my side. By default, Aspose.Words uses UTF8 encoding when exporting to Html. Could you please try the following code snippet on your side and let us know how it goes?

Document doc = new
Document(@“C:\Temp\Question
Marks.rtf”
);

MemoryStream stream = new MemoryStream();

doc.Save(stream, SaveFormat.Html);

LoadOptions lo = new LoadOptions();

lo.LoadFormat = LoadFormat.Html;

Document tempDoc = new Document(stream, lo);

stream.Close();

tempDoc.Save(@"C:\Temp\out.html");


Best Regards,