public static Run Text(string text) { var run = new Run { FontSize = Defaults.FontSize, AsciiFont = Defaults.FontFamily, }; run.AddText(text); return(run); }
public static Run AppendText(this Run source, string text) { if (source is null) { throw new ArgumentNullException(nameof(source)); } if (string.IsNullOrEmpty(text)) { throw new ArgumentException("message", nameof(text)); } source.AddText(text); source.FontSize = Defaults.FontSize; source.AsciiFont = Defaults.FontFamily; return(source); }
public static Run Stylize(this Run source, string text, int fontSize = Defaults.FontSize, string font = Defaults.FontFamily, bool italics = false, bool bold = false, bool underline = false) { source.AddText(text); source.AsciiFont = font; source.FontSize = fontSize; if (bold) { source.Bold = Defaults.True; } if (underline) { source.Underline = Defaults.SingleUnderline; } if (italics) { source.Italic = Defaults.True; } return(source); }