public static a.Run Init(this a.Run run, string text, Font font, Color?fontColor = null)
        {
            run.Text = new a.Text(text);
            var runProps = new a.RunProperties();

            run.PrependChild(runProps);
            runProps.SetFont(font ?? new Font("Calibri", 11), fontColor);
            return(run);
        }
Пример #2
0
        public static a.Run SetFont(this a.Run run, Font font, Color?fontColor = null)
        {
            var runProps = run.GetFirstChild <a.RunProperties>();

            if (runProps == null)
            {
                runProps = new a.RunProperties();
                run.PrependChild(runProps);
            }
            runProps.SetFont(font, fontColor);
            return(run);
        }
Пример #3
0
        public static void SetRunFont(Run run)
        {
            // Use an object initializer for RunProperties and rPr.
            RunProperties rPr = new RunProperties(
                new RunFonts()
                {
                    Ascii = "Arial"
                });

            run.PrependChild<RunProperties>(rPr);
        }