有没有办法将子报表放在SSRS的标题中?
我想使用子报告,因为它在许多报告的标题中使用。但是,子报告不会进入标题,字段值也不会进入。不过,参数会很好。
关于如何绕过这个问题有什么建议或参考吗?
I would like to use a sub report, since it gets used on many reports, in the header. However, sub reports won't go into the header and neither will field values. Although, parameters will go just fine.
Any suggestions or references for how to bypass this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我以另一种方式处理这个问题。
创建了一个仅包含页眉和页脚的报告。
然后,对于我们需要的每个报告,我们只需创建一个子报告。
我知道它远非完美。但这对我们的报告有用。
另一种选择是创建一个程序集,将数据泵入标头中的字段中。如果标题中没有太图形化的内容,则效果很好......
I approcahed this the other way.
Created a report which just contained a header and a footer.
Then for every report we need we just created a sub report.
I know it isn't anywhere near perfect. But it worked for our reports.
Another option is to create an assembly which pumps data into a field in the header. Works fine if there's nothing too graphical in the header...
我也遇到过完全相同的问题。几个小时后,我找到了解决方案(没有子报告)。
SSRS 2012 中存在“矩形”。我从来没有真正研究过它,因为我认为它只是用于图形用途。事实上,您可以将多个元素分组在其中。您可以将整个矩形发布为报表部分。您可以在其他报表中使用此报表部分,甚至可以在页眉或页脚中使用。
I've been confronted with the exact same problem. After several hours, I found a solution (without a subreport).
In SSRS 2012 exists the "Rectangle". I never really looked into it because I thought it's just for graphical use. In fact you can group multiple elements in it. The whole rectangle you can publish as Reportpart. This reportpart you can use in other reports, even in the header or footer.
在页眉或页脚的母版页级别使用
Globals!PageName
内置字段,然后在每个子报表中定义PageName
值。这将允许页眉或页脚根据PageName
变量中定义的字符串值进行更改。例如:将页脚文本框设置为:
[&PageName]
或=Globals!PageName
在母版页调用的每个子报表中,定义
PageName 值设置为:
我在代码视图中的子报表中、在该部分正下方的 tablix 定义中设置
PageName
值:有关可以使用的全局变量的更多详细信息,请参阅:
https://msdn.microsoft.com/en-us/library/dd255216.aspx
Use the
Globals!PageName
Built-in-field at the Master Page level in the header or footer, then define thePageName
value in each subreport. This will allow the header or footer to change with the string value defined in thePageName
variable.For example: set a footer textbox to:
[&PageName]
or=Globals!PageName
In each subreport called by the Master Page, define the
PageName
value to:I set the
PageName
value in the subreports, in code view, in the tablix definition directly below the section:For more details on Global variables that you can use look at:
https://msdn.microsoft.com/en-us/library/dd255216.aspx
一个建议可能对有限的情况有帮助:您可以使用数据集中的默认值填充参数,并在标头中使用该参数。当然,这一次只能为您提供一个字段/值,但如果您只需要从数据库中将一两个项目放入标头中,这可能是一个不错的解决方法。
One suggestion that may help in a limited subset of cases: you can fill a parameter with a default value from a dataset, and use that parameter in the header. Of course, this only gets you one field/value at a time, but if you only need one or two items from the database into your header this may be a decent workaround.
SSRS 不允许将子报告放入标头中。我遇到过这个问题,我想我有一个解决方案。添加子报表作为附加数据集,并将响应放入文本框中。它对我有用...?
SSRS will not allow subreports into the Header. I have had this issue, and I think I have a solution. Add the subreport as an additional dataset, and put the response into a text box. It works for me...?
从这个答案中得到了想法:
https://stackoverflow.com/a/57991114/11829240
无法真正将其发布在那里,因为该主题是关于rdlc,它只是客户端。
但我想说它适合这里。
创建一个图像,将其大小设置为按比例
,使用以下网址:&rs:Format=IMAGE
给我一个图像。&rc:OutputFormat=BMP
作为 BMP,因为报表无法处理 TIFF。&rc:dpix=1000&rc:dpiy=1000
给我一个更高的分辨率,所以它看起来不会难看编辑:似乎可以在 VisualStudio 中本地工作,但不能在 ReportServer 上工作。可能必须创建一个自定义 DLL 来进行身份验证。
EDIT2:
然后将图像源设置为数据库,使用以下表达式:
Mime Type to
image/bmp
,您就可以开始示例配置
c:\ssrs\ssrsutils_auth.txt
(将 [TAB] 替换为实际的 \t - ASCII 09):顺便说一句,请注意,SSRS 处理 CAS。
https://stackoverflow.com/a/61816621/11829240
Got the idea from this answer:
https://stackoverflow.com/a/57991114/11829240
can't really post it there, since the topic is about rdlc, which is only client-side.
But I would say it fits here.
Create an image, set its size to fit proportionally
, with the following url:&rs:Format=IMAGE
give me an Image.&rc:OutputFormat=BMP
as a BMP, since Reports can't handle TIFF's.&rc:dpix=1000&rc:dpiy=1000
give me a higher resolution, so it wont look uglyEDIT: Seems to work locally in VisualStudio but not on the ReportServer. Might have to create a custom DLL for the authentication.
EDIT2:
Then you set the image-source to database, use the following expression:
Mime Type to
image/bmp
and you are good to goExample-Config
c:\ssrs\ssrsutils_auth.txt
(replace [TAB] with actual \t - ASCII 09):By the way, be aware of the way, SSRS handles CAS.
https://stackoverflow.com/a/61816621/11829240