Exemple #1
0
        internal static void SetRichTextFontSize(List <TextParagraph> richText, double fontSize)
        {
            TextRun       firstRun       = GetFirstRun(richText);
            TextParagraph firstParagraph = GetFirstParagraph(richText);

            if ((firstRun != null) && (fontSize > 0.0))
            {
                firstRun.FontSize = new double?(UnitHelper.PixelToPoint(fontSize));
            }
            else if ((firstParagraph != null) && (fontSize > 0.0))
            {
                firstParagraph.FontSize = new double?(UnitHelper.PixelToPoint(fontSize));
            }
        }
Exemple #2
0
        internal static double?GetRichTextFontSize(List <TextParagraph> richText)
        {
            double?       nullable       = null;
            TextRun       firstRun       = GetFirstRun(richText);
            TextParagraph firstParagraph = GetFirstParagraph(richText);

            if ((firstRun != null) && firstRun.FontSize.HasValue)
            {
                return(new double?(UnitHelper.PointToPixel(firstRun.FontSize.Value)));
            }
            if ((firstParagraph != null) && firstParagraph.FontSize.HasValue)
            {
                nullable = new double?(UnitHelper.PointToPixel(firstParagraph.FontSize.Value));
            }
            return(nullable);
        }