Print a report Multiple times, (SSRS reporting services)

北战南征 提交于 2019-12-13 04:11:41

问题


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


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.


回答1:


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.



来源:https://stackoverflow.com/questions/12526795/print-a-report-multiple-times-ssrs-reporting-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!