Report Viewer with Inserted Pages

Posted by: kim on 11 February 2021, 4:27 pm EST

    • Post Options:
    • Link

    Posted 11 February 2021, 4:27 pm EST

    Hello,

    I am creating multiple section reports and combining them into a single report using as follows:

                    for (int y = 0; y < sourceRPT.Document.Pages.Count; y++)
                    {
                        hostRPT.Document.Pages.Add(Source.Document.Pages[y]);
                    }
    

    This all works fine when I send to printer and all the pages print, but when I use the Viewer LoadDocument(hostRPT) is rerunning the report and all my added pages are lost.

    How can I get around this or prevent the viewer from running the report?

    TIA

  • Posted 11 February 2021, 11:48 pm EST

    Hello,

    You can use the following code to view the report in the viewer:

    LoadDocument(hostRPT.Document)

    Thanks,

    Mohit

  • Posted 12 February 2021, 1:08 am EST

    Thank you!

    Is there any way I can check hostRPT to see if its been run before I call LoadDocument(hostRPT.Document) ?

    If it has not been run then I would need to call LoadDocument(hostRPT)

    TIA

  • Posted 12 February 2021, 6:36 am EST

    Hello,

    You can check the count of the page in hostRPT.Document, if the count is 0 then you need to call the LoadDocument(hostRPT).

    Thanks,

    Mohit

  • Posted 21 February 2021, 4:53 pm EST

    Thank you this is what I needed!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels