Reporting Services 2008:有没有办法根据报表的呈现方式来更改项目属性?
我正在写一份报告,可以很好地导出为 PDF。 但是,它无法正确导出到 Word 文档 (.doc)。
(页眉区域中的边距被忽略,这会导致分页符混乱、页脚文本丢失等。)
为了解决这个问题,我想禁用、启用和/或调整报告中的一些项目,具体取决于它是否呈现为 PDF 或 Word 文档。
有没有办法根据报表的呈现方式设置项目属性?
I am writing a report, which exports nicely to PDF. However, it does not export to a Word document (.doc) properly.
(Margins get ignored in the header area, which messes up pages breaks, footer text is missing, etc.)
To work around this, I want to disable, enable and/or re-size a few items in my report depending on if it is rendered as a PDF or a Word Document.
Is there any way to set an items properties, based on how a report is rendered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为解决您问题的唯一方法是:在报告中您可以访问 Globals.ReportServerUrl。 调用报表时,您可以在 URL 中指定其呈现类型(甚至尺寸等其他内容)。 您需要做的就是编写一些自定义代码来从 URL 中提取渲染类型,然后就完成了。
有关所有可能的 URL 参数的详细信息,请访问此处:http://technet. microsoft.com/en-us/library/ms154040.aspx
I think the only solution to your problem is this: in your report you can access Globals.ReportServerUrl. When calling a report you can specify its render type (and even other stuff like dimensions etc) in the URL. All you need to do is write some Custom Code to extract the render type from the URL and you're done.
For more info on all the possible URL parameters go here: http://technet.microsoft.com/en-us/library/ms154040.aspx
我有一个类似的场景,我需要在 ASP.NET 应用程序中使用报表查看器控件。 我提出的解决方案是隐藏报表查看器控件中的工具栏,并为各种格式创建我自己的下拉选择器(PDF、Excel 是我们当前使用的两种格式)。
解决方法是,在加载报表查看器控件时,我向报表传递一个附加参数,指示“RenderType=HTML”。 当请求获取 PDF 版本时,我使用相同的方法,除了使用 ServerReport.Render() 函数并传递“PDF 作为 RenderType 参数,对于 Excel 也是如此。
这允许我进行条件格式化/显示/在我的报告中隐藏各种报告格式的内容,
因为报告查看器 Web 控件支持从后面的代码渲染特定页面/缩放等功能,因此构建我们自己的用于操作报告的“工具栏”非常容易。其样式更适合我们的应用程序的优点(尽管这可以通过 css 来完成)它解决的另一个问题是需要活动 x 组件的奇怪打印功能,我们实现了自己的打印机制以将报告写出。 。
希望这有帮助
I had a similar scenario I needed to use the report viewer control in an asp.net app. The solution I came up with, was hiding the toolbar in the report viewer control, and creating my own drop-down selector for the various formats (PDF, Excel are the two we currently use).
The workaround is, when loading the report viewer control, I pass an additional paramter to my reports indicating "RenderType=HTML". When the request is made to get say the PDF Version, I use the same methodology, except I use the ServerReport.Render() function and pass "PDF as the RenderType Parameter, same for Excel.
This allows me to do conditional formatting/showing/hiding stuff in my reports for the various report formats.
Because the Report Viewer Webcontrol supports functionality for rendering specific pages/zooms from the code behind etc, it was pretty easy to build our own "toolbar" for manipulating the report, and gave us the advantage of styling it more suitable for our application, (although this can be done with css anyways). Another issue it solved was the weird print feature requiring the active x component, we implemented our own print mechanism to write the report out in a printer friendly manner.
Hope this helps.