Thanks for your request. In your case, you can save RTF to stream and then extract RTF string from this stream. Code will look like this:
private static string GetRtfString(string html)
string rtfString = "";
// Create a document and insert HTML into it.
DocumentBuilder builder = new DocumentBuilder();
// Save document to stream as RTF and get RTF string.
using (MemoryStream rtfStream = new MemoryStream())
byte rtfBytes = rtfStream.ToArray();
rtfString = Encoding.UTF8.GetString(rtfBytes);
Hope this helps.
Thanks for your help Alexey. It's exactly what I was looking for.
As I was using the above code with a evaluation version of Aspose.Words another question was raised. I hope you can answer this one too as it is a weird thing to explain.
Sometimes, my converted HTML code to RTF format causes the RTF Document to show weird signs/symbols of some kind. Example:
UPDATE ONGEVEER EEN UUR GELEDEN
Also, text colors don’t always show up as I expect. Are these things caused by possible limitations of the evaluation version of doesn’t Aspose.Words fully support HTML formatting when converting it to RTF?
Thanks in advance,
Thanks for your request. Could you please attach your source HTML and output RTF here? We will check the issue and provide you more information.
Please let us know if you need more assistance, we are always glad to help you.