Deploying Reports Created with the Standalone and Web Report Designers
The Standalone Report Designer supports Telerik Reporting XML report definitions (.TRDP) in a zip package and in a plain XML format (.TRDX legacy option).
Display TRDP or TRDX file in a Report Viewer
To show a report created with the Standalone Report Designer, you have the following options:
- Use UriReportSource and a path to the TRDX|TRDP file:
var uriReportSource = new Telerik.Reporting.UriReportSource();
// Specifying an URL or a file path
uriReportSource.Uri = "SampleReport.trdp";
// Adding the initial parameter values
uriReportSource.Parameters.Add(new Telerik.Reporting.Parameter("OrderNumber", "SO43659"));
Dim uriReportSource As New Telerik.Reporting.UriReportSource()
' Specifying an URL or a file path
uriReportSource.Uri = "SampleReport.trdp"
' Adding the initial parameter values
uriReportSource.Parameters.Add(New Telerik.Reporting.Parameter("OrderNumber", "SO43659"))
- Use XmlReportSource and read the plain XML of a TRDX file:
var xmlReportSource = new Telerik.Reporting.XmlReportSource();
// Specifying the XML markup of the report
xmlReportSource.Xml = @"<?xml version='1.0' encoding='utf-8'?>
<Report Width='3in' Name='userReport1' xmlns='http://schemas.telerik.com/reporting/2012/2'>
<Items>
<DetailSection Height='1in' Name='detailSection1'>
<Items>
<TextBox Value='=Parameters.OrderNumber.Value' Size='2in, 0.4in' Location='0.5in, 0.3in' Name='textBox1' />
</Items>
</DetailSection>
</Items>
<PageSettings>
<PageSettings PaperKind='Letter' Landscape='False'>
<Margins>
<MarginsU Left='1in' Right='1in' Top='1in' Bottom='1in' />
</Margins>
</PageSettings>
</PageSettings>
<ReportParameters>
<ReportParameter Name='OrderNumber'>
<AvailableValues />
</ReportParameter>
</ReportParameters>
</Report>";
// Adding the initial parameter values
xmlReportSource.Parameters.Add(new Telerik.Reporting.Parameter("OrderNumber", "SO43659"));
Dim xmlReportSource As New Telerik.Reporting.XmlReportSource()
' Specifying the XML markup of the report
xmlReportSource.Xml = "<?xml version='1.0' encoding='utf-8'?>" &
"<Report Width='3in' Name='userReport1' xmlns='http://schemas.telerik.com/reporting/2012/2'>" &
"<Items>" &
"<DetailSection Height='1in' Name='detailSection1'>" &
"<Items>" &
"<TextBox Value='=Parameters.OrderNumber.Value' Size='2in, 0.4in' Location='0.5in, 0.3in' Name='textBox1' />" &
"</Items>" &
"</DetailSection>" &
"</Items>" &
"<PageSettings>" &
"<PageSettings PaperKind='Letter' Landscape='False'>" &
"<Margins>" &
"<MarginsU Left='1in' Right='1in' Top='1in' Bottom='1in' />" &
"</Margins>" &
"</PageSettings>" &
"</PageSettings>" &
"<ReportParameters>" &
"<ReportParameter Name='OrderNumber'>" &
"<AvailableValues />" &
"</ReportParameter>" &
"</ReportParameters>" &
"</Report>"
' Adding the initial parameter values
xmlReportSource.Parameters.Add(New Telerik.Reporting.Parameter("OrderNumber", "SO43659"))
- Deserialize the XML report definition from a TRDX file : If working with CLR types and objects is your thing, you can deserialize the XML report definition and proceed following the basic concepts of the programming language and the.NET platform. For example you can create an InstanceReportSource and and set its ReportDocument property to the deserialized report object. See Serialize Report Definition in XML for more information.
- Unpackaging the XML report definition from a TRDP file : If you need to obtain a Telerik Report instance in code from a TRDP file, you can unpackage the content in code. Then create an InstanceReportSource and set its ReportDocument property to the unpackaged report object. See Package Report Definition for more information.
The only thing left to do is assign the resulting report sources to the report viewer's ReportSource property.