Declined
Last Updated: 26 Apr 2016 09:47 by ADMIN
ADMIN
Ivan Todorov
Created on: 07 Jul 2014 11:14
Category: RichTextEditor
Type: Bug Report
0
FIX. RadRichTextEditor - documents exported with the HtmlFormatProvider have their font sizes and other measurement properties stored as pixels
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);
1 comment
ADMIN
Stefan
Posted on: 26 Apr 2016 09:46
Declined as duplicate: http://feedback.telerik.com/Project/154/Feedback/Details/112110