ReportPackager problem - Resource Not Found

5 posts, 0 answers
  1. Steven Bixby
    Steven Bixby avatar
    13 posts
    Member since:
    Sep 2008

    Posted 07 Sep Link to this post

    For reasons of hiding customer details from other customers, I've elected to create some custom reports for my application using the standalone report designer.  The idea is that I can create any number of customized reports and drop them into place on each customer's machine as appropriate.

    I initially used .TRDP format, and it works fine; however, when branching a codeline with SVN, I realized I couldn't merge binary files very well, so I decided to go with .TRDX format for the ability to diff & merge report definitions. 

    In turn I created a bit of stand-alone code to run in my build environment that would convert all the TRDX files to TRDP for distribution.

    This uses the same method shown on the Telerik Reporting documentation; that is:

                using (var targetStream = File.Create(destfn)) {
                    var xmlString = File.ReadAllText(sourceName);
                     reportPackager.Package(xmlString, targetStream);
                }

    However, when I do this, and try to load the resulting TRDP in either stand-alone Report Designer or load into my ASP.NET code, I get errors saying "Resource Not Found".

    My reports typically have a customer-specific PictureBox, so there's an embedded resource block, which I believe is the issue.

    I tried converting my original TRDP and "packaged" TRDP file names to .zip so I could inspect them.   The original TRDP has two XML files and a folder Images with a JPG file - "pictureBox1.Value.JPG".   The packaged TRDP just has two XML files, and there's a very long BASE64-like block, no separate image files.

    How can I achieve this goal in an automated fashion?

     

  2. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 09 Sep Link to this post

    Hello Steven,

    Thank you for reporting the problem.
    It is reproducible when the TRDX (XML) contains an image in it on converting into a TRDP.
    The issue is logged din our system for improvement and your Telerik points are updated as a gratitude for bringing the issue to our attention.


    We can suggest you the following workaround:
    Instead of reading the XML, you can deserialize the report in order to save it as a TRDP file. For example:
    var appPath = HttpContext.Current.Server.MapPath("~/Reports/");
    var reportPath = Path.Combine(appPath, reportTRDX);
    var newReportPath = Path.Combine(appPath, reportTRDX.Replace(".trdx", ".trdp"));
    //if (!System.IO.File.Exists(newReportPath))
    //{
    //    //package TRDX
    //    var reportPackager = new ReportPackager();
    //    using (var targetStream = System.IO.File.Create(newReportPath))
    //    {
     
     
    //        var xmlString = System.IO.File.ReadAllText(reportPath);
    //        reportPackager.Package(xmlString, targetStream);
    //    }
    //}
     
    System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
    settings.IgnoreWhitespace = true;
     
    using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(reportPath, settings))
    {
        Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
            new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
     
        Telerik.Reporting.Report reportInstance = (Telerik.Reporting.Report)
            xmlSerializer.Deserialize(xmlReader);
     
        var reportPackager = new ReportPackager();
        using (var targetStream = System.IO.File.Create(newReportPath))
        {
            reportPackager.Package(reportInstance, targetStream);
        }
    }
    return new UriReportSource { Uri = newReportPath };
    For more details about the settings, please check Report Packaging and Serializing Report Definition in XML.


    Let us know if you need further help.

    Regards,
    Stef
    Telerik by Progress
    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. Steven Bixby
    Steven Bixby avatar
    13 posts
    Member since:
    Sep 2008

    Posted 09 Sep in reply to Stef Link to this post

    I will try this a little later today, in crisis mode at the moment.  Thank you for the potential workaround!
  5. Steven Bixby
    Steven Bixby avatar
    13 posts
    Member since:
    Sep 2008

    Posted 09 Sep Link to this post

    This worked fine, thank you!
  6. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 10 Sep Link to this post

    Hi Steven,

    Thank you for this update.
    We will aim to update the compression of TRDX files for consecutive releases, after the official R3 3016 as it is expected in less than a week.

    Regards,
    Stef
    Telerik by Progress
    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
Back to Top
DevCraft banner