Class ReportPackager
Packages and unpackages report documents in TRDP format. This is a zipped, XML-based file format for representing report documents. Starting with Telerik Reporting Q2 2016, the TRDP have become the default target file format for Telerik Report Designer and Telerik Report Server.
Inheritance
Namespace: Telerik.Reporting
Assembly: Telerik.Reporting.dll
Syntax
public class ReportPackager
Examples
The following example demonstrates how to package a report definition instance:
var report = new Report1();
var reportPackager = new ReportPackager();
using (var targetStream = System.IO.File.Create("PackageReport1.trdp"))
{
reportPackager.Package(report, targetStream);
}
Dim report = New Report1()
Dim reportPackager = New ReportPackager()
Using targetStream = System.IO.File.Create("PackagedReport2.trdp")
reportPackager.Package(report, targetStream)
End Using
The following example demonstrates how to package a XML report definition:
var reportPackager = new ReportPackager();
using (var targetStream = System.IO.File.Create("PackagedReport2.trdp"))
{
var xmlString = System.IO.File.ReadAllText("Report1.trdx");
reportPackager.Package(xmlString, targetStream);
}
Dim reportPackager = New ReportPackager()
Using targetStream = System.IO.File.Create("PackagedReport3.trdp")
Dim xmlString = System.IO.File.ReadAllText("Report1.trdx")
reportPackager.Package(xmlString, targetStream)
End Using
The following example demonstrates how to unpackage a .TRDP report definition:
var reportPackager = new ReportPackager();
using (var sourceStream = System.IO.File.OpenRead("Report1.trdp"))
{
var report = (Report)reportPackager.UnpackageDocument(sourceStream);
}
Dim reportPackager = New ReportPackager()
Using sourcetStream = System.IO.File.OpenRead("Report1.trdp")
Dim report = reportPackager.Unpackage(sourcetStream)
End Using
Constructors
ReportPackager()
Methods
Package(String, Stream)
Declaration
public void Package(string xmlDefinition, Stream targetStream)
Parameters
System.String
xmlDefinition
|
System.IO.Stream
targetStream
|
Package(IReportDocument, Stream)
Packages the specified report instance and writes the package to the specified System.IO.Stream.
Declaration
public void Package(IReportDocument report, Stream targetStream)
Parameters
IReportDocument
report
The Report object to package. |
System.IO.Stream
targetStream
The target stream to write the packaged document. |
Remarks
Use the targetStream parameter to specify an object that derives from the System.IO.Stream class, which is designed to write to streams. Classes that derive from the System.IO.Stream class include: System.IO.BufferedStream, System.IO.FileStream, System.IO.MemoryStream, etc.
Unpackage(Stream)
Unpackages the TRDP document contained by the specified System.IO.Stream.
Declaration
public Report Unpackage(Stream packageStream)
Parameters
System.IO.Stream
packageStream
The stream that contains the package to unpackage. |
Returns
Report
The Telerik.Reporting object being deserialized. |
Remarks
Use the packageStream parameter to specify an object that derives from the System.IO.Stream class, which is designed to write to streams. Classes that derive from the System.IO.Stream class include: System.IO.BufferedStream, System.IO.FileStream, System.IO.MemoryStream, etc.
UnpackageDocument(Stream)
Unpackages the TRDP and TRBP documents contained by the specified System.IO.Stream.
Declaration
public IReportDocument UnpackageDocument(Stream packageStream)
Parameters
System.IO.Stream
packageStream
The stream that contains the package to unpackage. |
Returns
IReportDocument
The Telerik.Reporting object being deserialized. |
Remarks
Use the packageStream parameter to specify an object that derives from the System.IO.Stream class, which is designed to write to streams. Classes that derive from the System.IO.Stream class include: System.IO.BufferedStream, System.IO.FileStream, System.IO.MemoryStream, etc.