Unplanned
Last Updated: 15 Aug 2017 09:33 by Svetlin
Svetlin
Created on: 10 Oct 2012 04:09
Category: RichTextEditor
Type: Feature Request
3
ADD. RadRichTextEditor - improve Html export to perform font-size export in different units.
Html export of RadRichTextBox to perform font-size export in different units.

Case 2:
If you export a document using the HtmlFormatProvider, all style properties which contain measurement units are exported in pixel units. This makes the exported documents look much smaller when opened on devices with higher pixel density.

WORKAROUND: use Regex to find, convert and replace the font-size attributes

            HtmlFormatProvider html = new HtmlFormatProvider();
            string res = html.Export(document);
            Regex regex = new Regex(@"font-size: [0-9]*\.?[0-9]*px");
            Match match = null;

            do
            {
                match = regex.Match(res);
                if (!match.Success)
                {
                    break;
                }

                string value = match.Value.Substring("font-size: ".Length, match.Value.Length - "font-size: ".Length - "px".Length);
                double pts = double.Parse(value) * 72 / 96;
                res = res.Replace(match.Value, @"font-size: " + Math.Round(pts, 4) + "pt");
            } while (match.Success);

            File.WriteAllText("output.html", res);
0 comments