RtfPipe
RtfPipe copied to clipboard
Parsing sub/superscript text does not work
Hi
I am trying to convert RTF files which contains a lot of sub- and superscript parts (like Ug=0,8 W/(m2K)).
Is this somehow possible?
My code looks like following:
var rtf = File.ReadAllText(rtfFilePath);
using var w = new StringWriter();
using var md = new PlainTextWriter(w);
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Rtf.ToHtml(rtf, md,
new RtfHtmlSettings { Indent = true, NewLineChars = "\n", NewLineOnAttributes = true, IndentChars = "\t" });
md.Flush();
return w.ToString();
After that I get it like this: Ug=0,8 W/(m2K)
EDIT: Apparently this issue is the PlainTextWriter
, because if I look at the html string, the
<sub>
and <sup>
tags are present.