public override RtfStyleDescriptor GetRtf() { var result = new RtfStyleDescriptor(); if (BackgroundBrush is SolidBrush) { result.BackColor = (BackgroundBrush as SolidBrush).Color; } if (ForeBrush is SolidBrush) { result.ForeColor = (ForeBrush as SolidBrush).Color; } if ((FontStyle & FontStyle.Bold) != 0) { result.AdditionalTags += @"\b"; } if ((FontStyle & FontStyle.Italic) != 0) { result.AdditionalTags += @"\i"; } if ((FontStyle & FontStyle.Strikeout) != 0) { result.AdditionalTags += @"\strike"; } if ((FontStyle & FontStyle.Underline) != 0) { result.AdditionalTags += @"\ul"; } return(result); }
private RtfStyleDescriptor GetRtfDescriptor(StyleIndex styleIndex) { var styles = new List <Style>(); //find text renderer TextStyle textStyle = null; var mask = 1; var hasTextStyle = false; for (var i = 0; i < _tb.Styles.Length; i++) { if (_tb.Styles[i] != null && ((int)styleIndex & mask) != 0) { if (_tb.Styles[i].IsExportable) { var style = _tb.Styles[i]; styles.Add(style); var isTextStyle = style is TextStyle; if (isTextStyle) { if (!hasTextStyle || _tb.AllowSeveralTextStyleDrawing) { hasTextStyle = true; textStyle = style as TextStyle; } } } } mask = mask << 1; } //add TextStyle css RtfStyleDescriptor result = null; if (!hasTextStyle) { //draw by default renderer result = _tb.DefaultStyle.GetRtf(); } else { result = textStyle.GetRtf(); } return(result); }
public override RtfStyleDescriptor GetRtf() { var result = new RtfStyleDescriptor(); if (BackgroundBrush is SolidBrush) result.BackColor = (BackgroundBrush as SolidBrush).Color; if (ForeBrush is SolidBrush) result.ForeColor = (ForeBrush as SolidBrush).Color; if ((FontStyle & FontStyle.Bold) != 0) result.AdditionalTags += @"\b"; if ((FontStyle & FontStyle.Italic) != 0) result.AdditionalTags += @"\i"; if ((FontStyle & FontStyle.Strikeout) != 0) result.AdditionalTags += @"\strike"; if ((FontStyle & FontStyle.Underline) != 0) result.AdditionalTags += @"\ul"; return result; }