Search code examples
asp.netsql-serverssrs-2008reporting-services

Print a report Multiple times, (SSRS reporting services)


I am currently working on SSRS reports 2008 displaying them in Website created in VS 2010 i.e., ASP.NET 4.0 C#.

My current issue is I have a report with only a Letterhead on it. And this report page needs to be printed multiple times based on the value in number of pages TextBox as shown enter image description here


To be a bit descriptive:

When the user enters the value in Number of Pages TextBox and clicks on this Print button icon, he/she lands on the page with ReportViewer control on it, displaying the report.This report has only a letterhead in the PageHeader of the report and here this report will be printed by clicking the default print button of ReportViewer control.

But, I am unable to figure out, how to print this report page as many times as there will be the value in the No of Pages TextBox (as shown in the fig.)
(The Letterhead of the company to be shown in report is retrieved from database through a Stored Procedure)

I tried a lot of Googling but to no avail.


Solution

  • Create a new report. This report should have 1 parameter called "number of copies" (or equivalent). It should also have a Tablix with 1 column and no borders, inside the cell insert a sub report pointing to the report with the letterhead.

    Your dataset query should be something like this:

    WITH dataset AS (
       SELECT 1 AS ID UNION ALL 
       SELECT ID + 1 FROM dataset WHERE ID < @Param
    )
    SELECT ID 
    FROM dataset --edit: obviously I was missing the table
    OPTION (MAXRECURSION 0)
    

    Then on your tablix, use this dataset, group by ID and on the group properties select "Page Breaks"->"Between each instance of a group".

    If I understood your question correctly, this should do the trick.