本文是小编为大家收集整理的关于在打印/导出 rdlc 报告时隐藏报告项目的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。
问题描述
我有一个带有多个表的RDLC,对于每个表,我都有一个隐藏报告中相应表的Toggle Textbox项目.但是,我不希望这些文本框在打印/导出的报告中可见.它们确实是为了禁用报告中的内容而不是内容本身.有没有办法从报告的打印布局和导出版本中隐藏这些切换框?
我查看了报告文本框的所有属性,以及可以用来切换可见性的可用表达式,但我没有找到可以用来隐藏该项目的任何东西.有一个DataElementOutput属性似乎是我想要的,但我相信它仅对XML有用.
推荐答案
晚了,但是有一个解决方案.您可以将参数添加到报告中以进行操作控制可见性,在打印事件中,更改参数值,然后刷新报告(ReportViewer1.refreshreport())
其他推荐答案
可以使用简单的可见性切换来实现这一点.您可以使用renderformat.isinteractive变量来确定报告查看器中是否显示了报告或正在导出. 关于此全局变量的解释,
此外,布尔旗(= globals!renderformat.isinteractive) 确定渲染扩展是否是交互式渲染器, 即不是导出格式.预览(GDI/Winforms)和HTML查看为 被认为是交互式渲染器.
设置要隐藏在导出到以下表达式
的文本框的可见性=NOT(Globals!RenderFormat.IsInteractive)
请参阅以下图像( blog.hoegaerden.be )知道分配给renderformat.isinteractive的值
其他推荐答案
您可以执行一些骇客尝试来实现这一目标: - 将文本框上的文本和边框设置为白色,因此它们不是粘性,但仍然可单击 - 使报告大于打印尺寸(纸张尺寸),然后将文本框移出打印区域(它们将被打印/导出,但在同一页面上不像您的桌子一样) - 将您的文本框放在顶部并设计它们看起来像标签,可以启用不同的视图(我知道,这不是您要求的:-))
)但是,解决此问题的最佳方法是将您的报告分为几个报告 - 对于每个表一个报告.
希望这会有所帮助!
欢呼,
pero
问题描述
I have an RDLC with multiple tables and for each table, I have a toggle TextBox Item that hides the corresponding table from the report. It works perfectly, however, I don't want these text boxes to be visible in the printed/exported reports. They are really meant for disabling content in the report and not as content themselves. Is there a way to hide those toggle boxes from only Print Layout and exported versions of the report?
I looked at all of the properties of the report textbox and at the available expressions that I can use to toggle visibility, but I didn't find anything that I can use to hide the item. There is a DataElementOutput property that seems to be what I want, but I believe that it is only useful for XML.
推荐答案
Late, but there are one solution. You can add a parameter to the report for handle control visibility and in the Print event, change the parameter value and then refresh the report (ReportViewer1.RefreshReport())
其他推荐答案
This can be achieved using a simple visibility toggle. You can use the RenderFormat.IsInteractive variable to determine whether a report is shown in report viewer or is being exported. An MSDN article explains this about this global variable,
Furthermore, a Boolean flag (=Globals!RenderFormat.IsInteractive) determines whether a rendering extension is an interactive renderer, i.e. not an export format. Preview (GDI/Winforms) and HTML viewing are considered interactive renderers.
Set the visibility of the text box you want to hide in the export to the following expression
=NOT(Globals!RenderFormat.IsInteractive)
Refer to the following image (courtesy of blog.hoegaerden.be) to know the values assigned to RenderFormat.IsInteractive
其他推荐答案
You can do some hacks to try to accomplish that like: - setting the text and border on your TextBox to be white so they are not vislble but still clickable - make report bigger than print size (paper size) and move your textboxes out of the print area (they will be printed/exported but not on the same page like your tables) - put your textboxes on top and design them to look like tabs which enable different views (I know, I know, this is not what you asked for :-) )
But the best way to solve this is to split your report in to several reports - for each table one report.
hope this helps!
cheers,
Pero