Crystal Reports - 如果页面上没有记录,则隐藏页眉 [英] Crystal Reports - Hide page header if there in no record on a page

查看:18
本文介绍了Crystal Reports - 如果页面上没有记录,则隐藏页眉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果最后一页没有记录(详细信息部分),如何隐藏页眉.如果最后一页有数据,则必须在最后一页显示页眉,否则隐藏页眉.

How to hide a page header if there is no record(details section) on last page. Page header must be shown on last page if there is some data on last page otherwise hide the page header.

Formaula pagenumber = totalpagecount 不起作用,因为它总是会抑制最后一页的页眉.

Formaula pagenumber = totalpagecount won't work as it will always suppress the last page's header.

推荐答案

将此公式放在详细信息部分的隐藏字段中:

Put this formula in a suppressed field in the detail section:

WhilePrintingRecords;
Global BooleanVar finished;
finished := OnLastRecord

并将其设为页眉中的 Suppress 公式:

And make this the Suppress formula in the page header:

Global BooleanVar finished

  • finished 初始化之前,页眉会显示出来.
  • 打印详细记录后,它将被设置为 false.
  • 当您最终到达最后一个详细信息部分时,finished 设置为 true.
  • 如果碰巧到了另一个页眉,finished仍然是true,Crystal会压制页眉.
    • Before finished is initialized the page header will show.
    • Once you print a detail record it'll be set to false.
    • When you finally reach the last detail section, finished is set to true.
    • If you happen to reach another page header, finished is still true, and Crystal will suppress the header.
    • 这是一个有趣的问题.我以前遇到过这种行为,但从未尝试过解决它.我认为您需要使用变量,因为在页眉中,像 Next()OnLastRecord 这样的常用选项无法区分要打印更多记录和拥有没有更多的记录要打印.我认为运行总计也会有同样的问题——在有更多记录要打印的页面上和在没有要打印记录的页面上,值会是相同的.

      It's an interesting problem. I've encountered this behavior before but never tried to solve it. I think you need to use a variable because in a page header, the usual options like Next() and OnLastRecord can't distinguish between having one more record to print and having no more records to print. I think running totals would have the same problem – the values would be the same on a page with one more record to print, and on a page with no records to print.

      这篇关于Crystal Reports - 如果页面上没有记录,则隐藏页眉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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