本文介绍了SSRS - 在特定组后添加分页符 - SQL Server 2008 R2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在第n组后添加分页符?

Is there a way to add a page break after nth group?

我有一个包含两列并按州分组的表格.

I have a table that has two columns and is grouped by states.

State |  Name 

MA       Sarah 
         Bob
NY       Jane
TX       Klein

我希望第三组 (TX) 在它自己的页面上.如何在特定组后添加分页符?

I want the 3rd group (TX), to be on it's own page. How do I add a page break after a specific group?

推荐答案

由于您使用的是 2008R2,您可以在 Tablix 中设置分页符以根据表达式有条件地启用/禁用 - 在您的情况下仅在 StateTX 的情况下启用它.以下是基于您的示例数据集的示例:

Since you're using 2008R2, you can set up page breaks in a Tablix to be conditionally enabled/disabled based on an expression - in your case you'd only be enabling it where the State is TX. Here's an example based on your sample Dataset:

我刚刚基于此创建了一个简单的表格:

I've just created a simple table based on this:

请注意,我添加了一个报告标题来显示页码.没有应用任何分页符,看起来如您所愿:

Note that I've added a Report Header to display a page number. Looks as you'd expect without any page breaks applied:

现在,如果您在设计器中选择 State 组并查看属性,您会注意到有一个分页符部分:

Now, if you select the State group in the Designer and look at the properties, you'll note there is a Page Break section:

我已将 Disabled 属性设置为:

I've set the Disabled property to be:

=IIf(Fields!State.Value = "TX", False, True)

即仅对 TX 组应用分页符.

i.e. only apply the Page Break for the TX group.

现在我们根据需要在报告中获得一个分页符:

Now we get one Page Break in the report as required:

这篇关于SSRS - 在特定组后添加分页符 - SQL Server 2008 R2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 22:17