如何计算报表的行数并隐藏标题
我正在使用 Rave Reports for delphi 创建我的第一份报告。 我的记录显示得很好,我正处于完成前的最后阶段。 我有一组记录,仅当记录上的“注释”字段有数据(即字符串数据)时,我才会在打印前事件上使用 if 语句显示这些记录。 我遇到的问题是,当没有显示记录时,我仍然看到我的页眉和页脚。 如果“评论”字段中没有包含数据的记录,如何隐藏页眉和页脚?
I'm creating my first report with Rave Reports for delphi. I've got the records displaying nicely and I'm on the final stretch before finishing.
I have a set of records which I'm displaying with an if statement on the before print event ONLY if the 'comment' field on the record has data (which is string data). This The problem I have is that when no records are shown I'm still seeing my header and footer. How can I hide the header and footer if I have no records with data in their 'comment' field?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不熟悉 Rave Reports,但您能否将页眉和页脚默认为不可见,然后在印前打印中,在执行评论数据存在时触发的代码时将它们设置为可见。
西蒙
I'm not familiar with Rave Reports but could you not default the header and footer to not being visible and then in the beforeprint, set them visible when you execute the code that triggers when the comment data is present.
Simon
谢谢您的帮助。 它引导我解决问题。 昨天我显然想太多了。 我尝试按照您的建议进行操作,虽然它没有结果,但当我有结果时,它缺少第一页上的页眉和页脚(奇怪的是页眉和页脚出现在第二页上)。
然后我查看了实际标题带上的 OnBeforePrint 事件。 由于某种原因,我认为这不会连接到数据视图,因为我认为只有数据带才能访问数据。 我尝试了他们的 if 语句,它有效。
如果其他人遇到这个问题,这里是我的标题数据带中的 OnBeforePrint 事件的代码:
以及如果没有 LineComment 字段携带数据则隐藏该行的数据带的代码:
希望对将来的某人有所帮助
Lloyd
Thanks for the help. It lead me to solve the problem. I was clearly overthinking the obvious yesterday. I tried doing what you suggested and whilst it worked for no results when I had results it was missing the header and footer off the first page (the odd thing was the header and footer were present on the second page).
I then looked into the OnBeforePrint event on the actual header band. I didn't think this would connect to the dataview for some reason as I thought only the databand would have access to the data. I tried the if statement in their and it's worked.
In case anyone else comes across this here is the code from my OnBeforePrint event in my header databand:
and my code for the databand which hides the row if no LineComment field carries data:
Hope that helps someone in the future
Lloyd