How take Report object from TRDP File?

3 posts, 0 answers
  1. Fernando
    Fernando avatar
    56 posts
    Member since:
    Sep 2012

    Posted 19 May Link to this post

    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. Stef
    Admin
    Stef avatar
    3042 posts

    Posted 19 May Link to this post

    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
  3. DevCraft banner
  4. Fernando
    Fernando avatar
    56 posts
    Member since:
    Sep 2012

    Posted 19 May in reply to Stef Link to this post

    Hi Stef,

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

    Thank you!

Back to Top