使用单个报告查看器创建多个PDF报告 [英] Creating multiple PDF reports with a single report viewer
问题描述
在基于单个报告查看器创建多个PDF文档时,我需要帮助.
我的页面上有几个下拉字段,用于获取登录用户的所有可能值.基于选择,我有一个SqlDataSource,它获取所需的记录数据.我的报表查看器基于SqlDataSource.
目前,对于我需要的每个PDF文件布局,我都有一个不同的报表查看器. 数据是相同的,但是布局根据下拉选择而有所不同."
如何消除对多个报表查看器的需求,并基于if语句动态更改PDF布局.
非常感谢,
Nasser Hamdan
I need help in creating multiple PDF documents based on a single report viewer.
My page has a couple of dropdown fields that get all possible values for the person that is logged in. Based on the selections, I have a SqlDataSource that gets the needed record data. My report viewer is based on the SqlDataSource.
Currently, I have a different report viewer for every PDF file layout that I need. "The data is the same, but the layout differes based on the drop down selection."
How can I eliminate the need for multiple report viewers, and dynamically change the PDF layout based on an if statement.
Thank you very much,
Nasser Hamdan
推荐答案
假设您将PDF查看器留给客户端,则可以通过将mime类型更改为"application/pdf"将二进制pdf从虚拟页面转储到客户端. br/>
Assuming you leave PDF viewer to the client you can dump binary pdf from a dummy page to client by changing mime type to "application/pdf".
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
// Fill data here with binay PDF supplied by reporter or create PDF here.
// You can check GET or POST parameters to decide what to report here.
Response.BinaryWrite( data );
}
这篇关于使用单个报告查看器创建多个PDF报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!