/// <summary> /// Sets the given value. /// </summary> void INullableValue.SetValue(object value) { if (value is uint) { this.argb = (uint)value; } else { this = Color.Parse(value.ToString()); } }
private void SetParagraphByRunStyles(StyleRunProperties element) { if (element == null) { return; } _pdfParagraph.Format.Font.Bold = element.Bold != null; _pdfParagraph.Format.Font.Italic = element.Italic != null; _pdfParagraph.Format.Font.Underline = element.Underline != null ? Underline.Single : Underline.None; if (element.FontSize != null) { _pdfParagraph.Format.Font.Size = Convert.ToSingle(element.FontSize.Val) / 2; _pdfParagraph.Format.Font.Name = element.RunFonts.Ascii?.Value ?? string.Empty; _pdfParagraph.Format.Font.Color = element.Color != null?PdfColor.Parse("#" + element.Color.Val) : PdfColor.Empty; } }
public void VisitRunProperties(RunProperties element) { if (_pdfParagraph == null) { return; } _pdfText.Font.Bold = element.Bold != null; _pdfText.Font.Italic = element.Italic != null; _pdfText.Font.Underline = element.Underline != null ? Underline.Single : Underline.None; if (element.FontSize != null) { _pdfText.Font.Size = Convert.ToSingle(element.FontSize.Val) / 2; _pdfText.Font.Name = element.RunFonts.Ascii.Value; _pdfText.Font.Color = element.Color != null?PdfColor.Parse("#" + element.Color.Val) : PdfColor.Empty; } }