New to Telerik Reporting? Download free 30-day trial

How to get the report definition of the processing report

Environment

Product Progress® Telerik® Reporting

Description

When report definition is modified with code its final state is generally unknown. It is actually the report definition of the Processing Report. For debugging purposes it is helpful to know its layout after all modifications in the code. This KB explains how to get it.

Solution

We may use the ItemDataBound event of the Report to serialize the report definition and save it to a TRDX/XML file, or pack it into a TRDP file. Here is a sample code :

private void Report1_ItemDataBound(object sender, EventArgs e)
{
    var procReport = (Telerik.Reporting.Processing.Report)sender;
    var definition = procReport.Report.ItemDefinition;

    string trdxFileName = "PathToSaveReportHere";
    SerializeReportDefinitionInTrdxFile(definition, trdxFileName);
}

private static void SerializeReportDefinitionInTrdxFile(ReportItemBase definition, string trdxFileName)
{
    using (System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(trdxFileName))
    {
        Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();

        xmlSerializer.Serialize(xmlWriter, definition);
    }
}

The generated report definition can be opened with the Standalone Report Designer. It may be necessary to adjust the ObjectDataSources.

In this article