This is a migrated thread and some comments may be shown as answers.

How take Report object from TRDP File?

2 Answers 1205 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 19 May 2016, 12:12 PM

Hi,

I am trying to load a trdp file into memory to read what parameters a Report has to create a filter page to fill up the parameters. I also need to set the connection string and provider name dynamically. I can do it using the code on the follow link:

http://www.telerik.com/support/kb/reporting/details/changing-the-connection-string-dynamically-according-to-runtime-data

But, it works for trdx (legancy) file. Using a UriReportSource, the code bellow does not work for trdp file to take a Report object and read information on the report.

Report DeserializeReport(UriReportSource uriReportSource)
    {
        var settings = new System.Xml.XmlReaderSettings();
        settings.IgnoreWhitespace = true;
        using (var xmlReader = System.Xml.XmlReader.Create(uriReportSource.Uri, settings))
        {
            var xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
            var report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
            return report;
        }
    }

This code with trdx (which is a xml) works fine, but my question is about the binary trdp.

How can I convert a uriReportSource (or given a path for a trdp file how to take it) into a Telerik.Reporting.Report object?

I need to to read the structure of the report and make changes (replace connectionstirng, read expected parameters, etc..).

Thank you.

2 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 19 May 2016, 03:09 PM
Hi Fernando,

You can unpackage the TRDP file and get a Telerik.Reporting.Report object - Report Packaging. Then the  report instance can be wrapped in an InstanceReportSource and passed to the same connection strings manager from the Changing the connection string dynamically according to runtime data KB article.


Let us know if you have further questions.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Fernando
Top achievements
Rank 1
answered on 19 May 2016, 03:23 PM

Hi Stef,

The Report Packaging (Unpackage method) works fine for my TRDP.

Thank you!

Tags
General Discussions
Asked by
Fernando
Top achievements
Rank 1
Answers by
Stef
Telerik team
Fernando
Top achievements
Rank 1
Share this question
or