在 RDLC 正文中显示页码 [英] Displaying page number in body of RDLC

查看:36
本文介绍了在 RDLC 正文中显示页码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取 RDLC 报告正文部分中的页码.Globals!PageNumber 只能在报表页眉或页脚中使用.如果我将 Row number 放入我的数据集并获取记录号会怎样.限制每页的记录数并根据记录数进行可见性计算是迄今为止我听说过的最佳解决方案.谁能教我这个逻辑?或者还有其他解决方法吗?

How do I get Page Number in Body Section of RDLC report. Globals!PageNumber can be used only inside either Report Header or Footer. What if I put Row number to my dataset and get the record number. Limiting the number of records per page and do the visibility calculation based on the records number is the best solution so far that I've heard of. Can anyone educate me on this logic? Or is there any other workaround for this?

附:其他所谓的解决方案,如使用自定义代码,不会为您提供正确的页码.它将始终显示 1.

P.S: Other so-called solution like using Custom code is not giving you the correct page number. It will always show 1.

推荐答案

没有比这更简单的方法来获取正文中的页码了.我认为使用数据集行数是唯一可靠的方法.

There isn't really an easier way to get the page number in the body. I think working with the dataset row count is the only reliable way.

我这里有一个简短的 SQL 语句来获取项目状态信息:

What I have here is a short SQL statement to get Project Status information:

SELECT * FROM PROJ_STATUS

所以我将行号添加为一个字段,并将其除以每页我想要的记录数并加1(给我每行的页码)

So I'll add the row number as a field, and also divide it by the number of records I want per page and add 1 (giving me the page number of each row)

SELECT * , ((DENSE_RANK() OVER(ORDER BY PRS_ID) -1)  / 3 ) +1  AS [CountRow]  FROM PROJ_STATUS

现在在我的报告中,我有一个表格显示状态名称以及它们是否处于活动状态...我还将页码添加为一列.

Now in my report I've got a table showing the status names and if they are active or not... I'll also add the page number as a column.

接下来在报告中放入一个列表,然后将表格放入其中.

Next put a list in the report and put the table inside it.

然后单击列表左上角,在属性窗口中将数据集设置为您正在使用的数据集.

Then click the top left square corner on the list and in the properties window set the dataset to the one you are using.

然后右键单击列表中的行组并将分组设置为页码列.

Then right click on the row group in the list and set the grouping to the page number column.

并在实例之间放置分页符.

And put page breaks in between instances.

就这样!

@4Star 为 -1 的原因.看到没有 -1,第三行在第二页上.

Reason why the -1 for @4Star. See that without the -1 the 3rd row is on the second page.

这篇关于在 RDLC 正文中显示页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆