ActiveReports allows reports to be saved in their own standard format called an RDF file (Report Document Format). In this format, the data is static. The saved report displays the data that is retrieved when you run the report. You can save a report to an RDF file and load it into the viewer control.
Section report can be stored as an RDF document using the SectionDocument class. It is the intermediate format and can be used in following scenarios:
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
Dim rpt As New YourReportName() |
To write the code in C#
C# code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
YourReportName rpt = new YourReportName(); |
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
Viewer1.Document.Load("Location of the .RDF File") |
To write the code in C#
C# code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
viewer1.Document.Load(@"Location of the .RDF File"); |
The following examples show what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
Dim strm As New System.IO.MemoryStream() Dim rpt As New YourReportName() rpt.Run() rpt.Document.Save(strm) Dim theBytes(strm.Length) As Byte strm.Read(theBytes, 0, Int(strm.Length)) strm.Position = 0 Viewer1.Document.Load(strm) |
To write the code in C#
C# code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
System.IO.MemoryStream strm = new System.IO.MemoryStream(); YourReportName rpt = new YourReportName(); rpt.Run(); rpt.Document.Save(strm); byte[] theBytes = new byte[strm.Length]; strm.Read(theBytes, 0, (int)strm.Length); strm.Position =0; viewer1.Document.Load(strm); |