In-memory Documents

/
    Description

    The dynamic (in-memory) report sample.

    Dynamic report can be created at run time. You can register dynamic report document from code-behind by using the static C1ReportViewer.RegisterDocument method.

    The C1ReportViewer.RegisterDocument method accepts two parameters: the first parameter is the name of the dynamic report document; the second parameter is a delegate, which will be called in order to generate report document

    The FileName property should be set to the name of the dynamic report that is used as first parameter for the C1ReportViewer.RegisterDocument method.

    The following is a sample code how to register and display the dynamic report document:

    ASPX code:
    -------------
    	<C1ReportViewer:C1ReportViewer runat="server" ID="C1ReportViewer1" 
    		FileName="InMemoryBasicTable" Zoom="75%" Height="475px" Width="100%">
    	</C1ReportViewer:C1ReportViewer> 
    ASPX.CS code:
    -------------
    	public partial class InMemoryDocument : System.Web.UI.Page
    	{
    		protected void Page_Load(object sender, EventArgs e)
    		{
    			C1ReportViewer.RegisterDocument("InMemoryBasicTable",
    						BasicTable.MakeDoc);
    		}
    	}
    
    	/// <summary>
    	/// BasicTable in-memory document.
    	/// </summary>
    	public class BasicTable
    	{
    		static public C1PrintDocument MakeDoc()
    		{
    			C1PrintDocument doc = C1ReportViewer.CreateC1PrintDocument();
    			RenderText rtxt1 = new RenderText(doc);
    			rtxt1.Text = "Some text goes here";
    			rtxt1.Style.Font = new Font(rtxt1.Style.Font.FontFamily, 14);
    			rtxt1.Style.Padding.Bottom = new C1.C1Preview.Unit("5mm");
    			doc.Body.Children.Add(rtxt1);
    			return doc;
    		}
    	}
    
    Note:  You can register several dynamic reports under different names and switch between these reports by changing the FileName property on the server side or the client side.
    Documentation