In some cases, a multi-page report will display all on one page with overlapping text. When exported to a PDF file, the report will display properly, but the C1ReportViewer display is incorrect. To handle this issue, you need to edit the MakeReport() method and to return a report instead of a document.
Edit the MakeReport() Method:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Public Function MakeReport() As C1.C1Preview.C1PrintDocument |
To write code in C#
C# |
Copy Code
|
---|---|
public C1.C1Preview.C1PrintDocument MakeReport() |
Initially, your MakeReport() method may look like one of the following samples:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Public Function MakeReport() As C1.C1Report.C1Report |
To write code in C#
C# |
Copy Code
|
---|---|
public C1.C1Report.C1Report MakeReport() |
You need to edit the MakeReport() method to reflect one of the following samples:
Return a Report:
Once you've edited your MakeReport() method, you need to make sure you're returning a report instead of a document. You can use the following code to return a report:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Return rpt |
To write code in C#
C# |
Copy Code
|
---|---|
Return rpt; |
For a complete example of the MakeReport() method and returning a report, see the following samples:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Public Function MakeReport() As C1.C1Report.C1Report ' Dummy datatable Dim dr As DataRow Dim dt As New DataTable dt.Columns.Add("Row") For i As Integer = 0 To 100 dr = dt.NewRow dr("Row") = "This is row " & i dt.Rows.Add(dr) Next ' Bind report Dim rpt As New C1.C1Report.C1Report() rpt.Load(Server.MapPath("RptTest.xml"), "Test") rpt.DataSource.Recordset = dt Return rpt End Function |
To write code in C#
C# |
Copy Code
|
---|---|
public C1.C1Report.C1Report MakeReport() { // Dummy datatable DataRow dr = null; DataTable dt = new DataTable(); dt.Columns.Add("Row"); for (int i = 0; i <= 100; i++) { dr = dt.NewRow(); dr["Row"] = "This is row " + i; dt.Rows.Add(dr); } // Bind report C1.C1Report.C1Report rpt = new C1.C1Report.C1Report(); rpt.Load(Server.MapPath("RptTest.xml"), "Test"); rpt.DataSource.Recordset = dt; return rpt; } |