Report Book HTML 5 and MVC

4 posts, 0 answers
  1. Ro
    Ro avatar
    1 posts
    Member since:
    Jan 2014

    Posted 16 Oct 2014 Link to this post

    Hi. I have two reports that have the same page header, data sources, and etc., but different page footer. I need them to be in a single one report, because I need it to print them together.

    Here's the thing. In my view I was using:

    var typeReportSource = new TypeReportSource() { TypeName = "../Reports/Report1.trdx" };
    typeReportSource.Parameters.Add("IdYear", (object)(Convert.ToInt32(ViewBag.IdYear)));

    @(Html.TelerikReporting().ReportViewer()
           .Id("reportViewer1")
           .ServiceUrl("../../api/reports")
           .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
           .ReportSource(typeReportSource)
           .ViewMode(ViewModes.INTERACTIVE)
           .ScaleMode(ScaleModes.SPECIFIC)
           .Scale(1.0)
           .PersistSession(false)
    )

    And I had the same for Report2. But now I need to have them both in a single Report, and I've read that I can use ReportBook.

    The examples I found show code like this:
     reportBook.Reports.Add(new Report1());
     reportBook.Reports.Add(new Report2());


    But I am working with the .trdx files, not with the Visual Studio Designer. So I can't figure out how to do it. I found some reads about Activator.CreateInstance

    I need some guidance. I am kind of stucked here.

    Thanks in advance.
  2. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 20 Oct 2014 Link to this post

    Hi Ro,

    You can use a custom resolver in the Reporting REST service's CreateReportResolver method. In the resolver's Resolve method is received a string sent by the viewer's reportSource.report. Based on this string you can determine which reports to get, deserialize TRDX files if needed, and add them in a ReportBook. Finally, you need to return a valid report source object.


    I hope the above information is helpful.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. kfrancis
    kfrancis avatar
    69 posts
    Member since:
    Dec 2008

    Posted 26 Jun 2015 in reply to Stef Link to this post

    I'm sorry, could someone from Telerik please post some code for this? The documentation for the HTML5 viewer is just atrociouscompared to the other Telerik offerings.
  5. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 29 Jun 2015 Link to this post

    Hi kfrancis,

    Please elaborate on the exact scenario, the type of reports and the viewer you will use. Feel free to open support ticket and send us a demo project to illustrate your settings. Details how the HTML5 viewer works are available in this forum post.

    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
Back to Top