Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing sub/superscript text does not work #82

Open
ITaluone opened this issue Apr 25, 2023 · 0 comments
Open

Parsing sub/superscript text does not work #82

ITaluone opened this issue Apr 25, 2023 · 0 comments

Comments

@ITaluone
Copy link

ITaluone commented Apr 25, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant