示例#1
0
 /// <summary>
 /// Adds an <see cref="InlineText"/> at the end of the <see cref="InlineString"/> being built.
 /// </summary>
 /// <param name="text">The <see cref="InlineText"/> to add.</param>
 public void Add(InlineText text)
 {
     if (ReferenceEquals(text, null))
     {
         throw new ArgumentNullException("text");
     }
     InternalAddText(text.Text, text);
 }
示例#2
0
 /// <summary>
 /// Actually adds a string text or an inline text.
 /// </summary>
 /// <param name="text">A string version of the text.</param>
 /// <param name="inline_text">An InlineText version of the text if available, or null otherwise.</param>
 internal void InternalAddText(string text, InlineText inline_text)
 {
     if (text.Length == 0)
     {
         return;
     }
     if (_Contents.Count > 0 &&
         _Contents[_Contents.Count - 1].Property == Property &&
         _Contents[_Contents.Count - 1].Run is InlineText)
     {
         var x = _Contents[_Contents.Count - 1].Run as InlineText;
         _Contents[_Contents.Count - 1] = new InlineRunWithProperty(Property, new InlineText(x.Text + text));
     }
     else
     {
         _Contents.Add(new InlineRunWithProperty(Property, inline_text ?? new InlineText(text)));
     }
 }
示例#3
0
 /// <summary>
 /// Adds an inline text, returning this instance.
 /// </summary>
 /// <param name="text">InlineText to add.</param>
 /// <returns>this instance.</returns>
 public InlineBuilder Append(InlineText text)
 {
     Add(text); return(this);
 }