I have an RTF
format text, received from a UWP RichEditBox
by calling Editor.Document.GetText(TextGetOptions.FormatRtf, out string rtf);
. I need to convert it to an html, but the best solution what I found is the MarkupConverter
. Anyway, this uses a WPF RichTextBox
, which loads the RTF formatted text, then gets from there as an XAML, and then converts it to HTML.
The problem is that if I set a bigger font size, in RTF displays as fs44
, and when it converts to XAML, it is shown the following way: FontSize="34.666666666666664"
. I would like to see FontSize="34pt"
(or 35, doesn't matter).
I understand why is this happening, but is there a way to tell the RichTextBox to round it and put that pt text?
I would be also thankful if you can suggest a better way to convert RTF to HTML.
question from:
https://stackoverflow.com/questions/65953078/rtf-to-html-via-richtextbox-how-to-set-correct-font-sizes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…