SQL SSRS 报表生成器 - 仅在第一页上显示标题(带页码)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16306092/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 15:03:03  来源:igfitidea点击:

SSRS Report Builder - Only Show Header On First Page (With Page Numbers)

sqlreporting-services

提问by RiceRiceBaby

So I am running into the problem where my report header is being displayed on every page, but I only want to display it on the first page. The solution that people on this forum have given is to just put the header in the main content. The problem with this is that my header shows the page number + total pages (i.e. Page 1 of 3 pages). I cannot move my header to the body because I will lose access the page numbers. For some reason, Report Builder will only allow you to have access to the page numbers via the header. Does anyone have any solution to this problem?

所以我遇到了在每个页面上都显示我的报告标题的问题,但我只想在第一页上显示它。这个论坛上的人给出的解决方案是将标题放在主要内容中。问题在于我的页眉显示页码 + 总页数(即第 1 页,共 3 页)。我无法将标题移到正文,因为我将无法访问页码。出于某种原因,报表生成器只允许您通过页眉访问页码。有没有人有解决这个问题的方法?

回答by LeSteelBox

Write an expression to hide the textboxes that hold the header information.

编写一个表达式来隐藏包含标题信息的文本框。

The expression would look like this:

表达式如下所示:

=iif(Globals!PageNumber = 1, FALSE, TRUE)

To get to the expression property: right-click text box >> text box properties >> visibility >> select "Show or hide based on expression" >> insert expression above

要获取表达式属性:右键单击文本框 >> 文本框属性 >> 可见性 >> 选择“根据表达式显示或隐藏”>> 在上面插入表达式

cheers

干杯

回答by TLaV

I had the same issue, where I only wanted the header to show on the first page. The solution I came up with was to stick all of my objects from the header into a rectangle, so it was now acting as a container. I then placed that container into the body. In the report properties, in the code section, I borrowed from this post Access Page number in report body In SSRSto create functions, which would allow me to pull the page numbers into the body section. Then in my rectangle/container, I set the visibility property to =code.PageNumber>1. I hope this helps!

我遇到了同样的问题,我只希望标题显示在第一页上。我想出的解决方案是将标题中的所有对象粘贴到一个矩形中,因此它现在充当了一个容器。然后我将该容器放入体内。在报告属性中,在代码部分,我从这篇文章中借用了SSRS 中报告正文中的访问页码来创建函数,这将允许我将页码拉入正文部分。然后在我的矩形/容器中,我将可见性属性设置为 =code.PageNumber>1。我希望这有帮助!