Adds a RenderObject into the block flow of the current document, and resolves it.

This method can only be used if IsStartEndDocMode is true.

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

Syntax

C#
public bool RenderBlock(
	RenderObject ro
)
Visual Basic
Public Function RenderBlock ( _
	ro As RenderObject _
) As Boolean

Parameters

ro
Type: C1.C1Preview..::..RenderObject
The RenderObject to add to the block flow.

Return Value

true if no warnings were generated by this call, false otherwise.

Remarks

As all other RenderBlock..., RenderDirect... and RenderInline... methods, This method can only be used between calls to StartDoc()()()() and EndDoc()()()() on the current document, i.e. when the IsStartEndDocMode property is true.

Do not use this method if the document is generated with a call to the Generate()()()() method.

Examples

The following code uses the RenderBlock(RenderObject) method to add the render object to the document:

Copy CodeVisual Basic
Private _sampleText As String = "This is an example"
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    generateC1PrintDocument(C1PrintDocument1)
End Sub
Private Sub generateC1PrintDocument(ByVal doc As C1.C1Preview.C1PrintDocument)
    ' Render the document.
    doc.StartDoc()
    Dim theader As C1.C1Preview.RenderTable = New C1.C1Preview.RenderTable(Me.C1PrintDocument1)
    ' Set up alignment for the columns of the header.
    theader.Cells(0, 0).Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Left
    theader.Cells(0, 1).Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center
    theader.Cells(0, 2).Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Right
    theader.CellStyle.Font = New Font("Arial", 14)
    theader.Cells(0, 0).Text = "Left part"
    theader.Cells(0, 1).Text = "Center part"
    theader.Cells(0, 2).Text = "Right part"
    doc.RenderBlock(theader)
    ' First render some block flow text.
    doc.RenderBlockText(_sampleText)
    ' Now render direct text at an arbitrary position on the page.
    doc.RenderDirectText("3cm", "4cm", "This is direct text. It can wrap inside the specified width.", "60%", New Font("Arial", 20), Color.Red, C1.C1Preview.AlignHorzEnum.Left)
    doc.EndDoc()
End Sub
Copy CodeC#
private string _sampleText = "This is an example";
private void Form1_Load(object sender, EventArgs e)
{
    generateC1PrintDocument(c1PrintDocument1);
}
private void generateC1PrintDocument(C1.C1Preview.C1PrintDocument doc)
{
    // Render the document.
    doc.StartDoc();
    C1.C1Preview.RenderTable theader = new C1.C1Preview.RenderTable(this.c1PrintDocument1);
    // Set up alignment for the columns of the header.
    theader.Cells[0, 0].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Left;
    theader.Cells[0, 1].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center;
    theader.Cells[0, 2].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Right;
    theader.CellStyle.Font = new Font("Arial", 14);
    theader.Cells[0, 0].Text = "Left part";
    theader.Cells[0, 1].Text = "Center part";
    theader.Cells[0, 2].Text = "Right part";
    doc.RenderBlock(theader);
    // First render some block flow text.
    doc.RenderBlockText(_sampleText);
    // Now render direct text at an arbitrary position on the page.
    doc.RenderDirectText("3cm", "4cm", "This is direct text. It can wrap inside the specified width.", "60%", new Font("Arial", 20), Color.Red, C1.C1Preview.AlignHorzEnum.Left);
    doc.EndDoc();
}

See Also