internal void CopyFrom(RtfCharFormat src) { if (src == null) { return; } Begin = src.Begin; End = src.End; if (Font == null && src.Font != null) { Font = new FontDescriptor(src.Font.Value); } if (AnsiFont == null && src.AnsiFont != null) { AnsiFont = new FontDescriptor(src.AnsiFont.Value); } if (FontSize < 0 && src.FontSize >= 0) { FontSize = src.FontSize; } if (FontStyle.IsEmpty && !src.FontStyle.IsEmpty) { FontStyle = new FontStyle(src.FontStyle); } if (BgColor == null && src.BgColor != null) { BgColor = new ColorDescriptor(src.BgColor.Value); } if (FgColor == null && src.FgColor != null) { FgColor = new ColorDescriptor(src.FgColor.Value); } }
/// <summary> /// Add a character formatting to a range in this paragraph. /// To specify the whole paragraph as the range, set begin = end = -1. /// Format that is added latter will override the former, if their /// range overlays each other. /// </summary> /// <param name="begin">Beginning of the range</param> /// <param name="end">End of the range</param> public RtfCharFormat AddCharFormat(int begin, int end) { var fmt = new RtfCharFormat(begin, end, Text.Length); _charFormats.Add(fmt); return(fmt); }
/// <summary> /// Internal use only. /// Constructor specifying allowed content blocks to be contained. /// </summary> /// <param name="allowParagraph">Whether an RtfParagraph is allowed.</param> /// <param name="allowFootnote">Whether an RtfFootnote is allowed in contained RtfParagraph.</param> /// <param name="allowControlWord"> /// Whether an field control word is allowed in contained /// RtfParagraph. /// </param> /// <param name="allowImage">Whether RtfImage is allowed.</param> /// <param name="allowTable">Whether RtfTable is allowed.</param> internal RtfBlockList(bool allowParagraph, bool allowFootnote, bool allowControlWord, bool allowImage, bool allowTable) { _blocks = new List <RtfBlock>(); _allowParagraph = allowParagraph; _allowFootnote = allowFootnote; _allowControlWord = allowControlWord; _allowImage = allowImage; _allowTable = allowTable; _defaultCharFormat = null; }
public RtfParagraph(bool allowFootnote, bool allowControlWord) { Text = new StringBuilder(); LineSpacing = -1; _margins = new Margins(); _align = Align.Left; //Changed default to .Left as .None was spreading text accross page. _charFormats = new List <RtfCharFormat>(); _allowFootnote = allowFootnote; _allowControlWord = allowControlWord; _footnotes = new List <RtfFootnote>(); _controlWords = new List <RtfFieldControlWord>(); _blockHead = @"{\pard"; _blockTail = @"\par}"; _startNewPage = false; FirstLineIndent = 0; _defaultCharFormat = null; }
public DisjointRange() { head = -1; tail = -1; format = null; }