Adds a text string with the specified text color to the current paragraph content.

Namespace:  C1.C1Preview
Assembly:  C1.C1Report.2 (in C1.C1Report.2.dll)

Syntax

C#
public ParagraphText AddText(
	string text,
	Color textColor
)
Visual Basic
Public Function AddText ( _
	text As String, _
	textColor As Color _
) As ParagraphText

Parameters

text
Type: System..::..String
The text string to add.
textColor
Type: System.Drawing..::..Color
The text color to use to render the string.

Return Value

A ParagraphText object representing the specified text string.

Remarks

This method creates a ParagraphText, initializes it with the specified text and text color, and adds it to the current collection.

Examples

The following example adds a string of text with color to the current paragraph:

Copy CodeVisual Basic
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    MakeDoc(C1PrintDocument1) 
    C1PrintDocument1.Generate()
End Sub 
Private Sub MakeDoc(ByVal doc As C1.C1Preview.C1PrintDocument)
    Dim rp As New C1.C1Preview.RenderParagraph()
    rp.Content.AddText("ComponentOne Preview for .NET", Color.Blue)
    doc.Body.Children.Add(rp)
End Sub
Copy CodeC#
private void Form1_Load(object sender, EventArgs e)
{
    MakeDoc(c1PrintDocument1);
    c1PrintDocument1.Generate();
}
private void MakeDoc(C1.C1Preview.C1PrintDocument doc)
{
    C1.C1Preview.RenderParagraph rp = new C1.C1Preview.RenderParagraph();
    rp.Content.AddText("ComponentOne Preview for .NET", Color.Blue);
    doc.Body.Children.Add(rp);
}

See Also