ReportViewer报表头(ReportViewer Report Header)

编程入门 行业动态 更新时间:2024-10-27 23:29:18
ReportViewer报表头(ReportViewer Report Header)

我在VS 2010中使用ReportViewer将某些旧版MS Access报告移植到C#应用程序。 我需要创建一个报告标题,它显示在页面标题上方第一页的最顶部,与在Access中完成的方式相同,但我没有任何运气。

当然有办法做到这一点?

编辑这是我目前的进展。

尝试#1 :将报表标题元素放在页眉中,并为第一个页面以外的每个页面隐藏它们。 不幸的是,这在后续页面中留下了很大的空白空间,因为基于内容无法在每页的基础上调整页眉高度。

尝试#2 :将报表标题元素放在报表正文中。 如果页眉仅包含表的列标题,则此方法可以正常工作。 您可以为每个页面设置列标题行。 但是,由于无法在报表正文中显示,因此您无法显示页码等其他内容。

尝试#3 :使用主报表显示报表标题和子报表以显示其他所有内容。 由于您无法使用子报表的页眉或页脚,因此失败了。

在这一点上,我没有选择。 有没有我没有尝试或做的事情我需要切换到另一个报告平台?

I am using ReportViewer in VS 2010 to port certain legacy MS Access reports to a C# application. I need to create a report header that is shown at the very top of the first page above the page header much in the same way that it's done in Access, but I'm not having any luck.

Surely there's a way to do this?

Edit Here's my progress so far.

Attempt #1: Put the report header elements in the page header and have them turn hidden for every page other than the first one. Unfortunately this leaves a big empty space in subsequent pages because the page header height cannot be adjusted on a per-page basis based on the content.

Attempt #2: Put the report header elements in the report body. This can work if the page header only contains the column headers for a table. You can set the column header row to appear for every page. However you cannot have other things like the page number appear since it cannot be displayed in the report body.

Attempt #3: Use a master report to display the report header and a subreport to display everything else. This fails miserably since you can't use the page header or footer of a subreport.

At this point I'm out of options. Is there something I haven't tried or do I need to switch to another reporting platform?

最满意答案

最后,我必须发挥创意。 我将报表标题数据放在报表正文中。 在下面,我把应该在页眉上的项目。 我还复制了实际页面标题上的那些,但设置了标题,因此它不会显示在第一页上。 这适用于简单的静态文本,但如果页眉包含任何简短的聚合数据,则需要更多工作。

这是一个可怕的黑客,但它完成工作,直到我可以转向更好的报告平台。

In the end I had to get creative. I placed my report header data on the report body. Underneath that I put the items that should be on the page header. I also copied those on the actual page header but set the header so it wouldn't show up on the first page. This works well for simple static text although it'd need more work if the page header contained any short of aggregate data.

It's a horrible hack, but it gets the job done until I can move to a better reporting platform.

更多推荐

本文发布于:2023-07-15 22:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119379.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表头   ReportViewer   Header   Report

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!