When using the code below, the output text is followed by this block:
{\rtlch\afs24\ltrch\fs24\insrsid10976062\par}
Which automatically creates a new line because as I understand it, we are at the end of a paragraph. Is there a way to avoid this block from being added or prevent a new line from following “This is some text…” ? I don’t care about any of the formatting or paragraph information.
Thank you!
string text = $"<html><body>This is some text..</body></html>";
string rtfString = "";
// Create a document and insert HTML into it.
Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder();
builder.InsertHtml(text);
// Save document to stream as RTF and get RTF string.
using (MemoryStream rtfStream = new MemoryStream())
{
builder.Document.Save(rtfStream, SaveFormat.Rtf);
byte[] rtfBytes = rtfStream.ToArray();
rtfString = Encoding.UTF8.GetString(rtfBytes);
}
Console.WriteLine(rtfString);