RDLC:如何在一份报告中打印多个表格
我正在生成 RDLC XML 架构并在 ReportViewer 控件中显示报告。那里没有问题。
现在,我想要一个包含 2 个表和 2 个不同数据集的报告。
生成类似这样的内容:
<Body>
<ReportItems>
<Table Name="Table1">
....
</Table>
<Table Name="Table2">
....
</Table>
</ReportItems>
</Body>
但是,打印时,两个表都从顶部开始,将一个表打印在另一个表之上(不太好)
有办法告诉 Table2 应该在 Table1 之后开始吗?
更新:我尝试过使用假数据源的List
,但它不起作用。
I'm generating the RDLC XML schema and showing the report in the ReportViewer control. No problems there.
Now, I want a report with 2 tables, with 2 differents dataset.
Something like this gets generated:
<Body>
<ReportItems>
<Table Name="Table1">
....
</Table>
<Table Name="Table2">
....
</Table>
</ReportItems>
</Body>
But, when printed, both tables start from the top, printing one table over the other (not nice)
Is there a way to tell that Table2 should start after Table1?
Update: I've tried with List
with a fake DataSource, but it does not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用大量带有多个表格的报告,我只需将第二个表格的开头恰好添加到第二个表格的结尾处,渲染时它们会一个接一个地出现。
因此,您需要配置第一个表:
并
注意 Table1.Top+Table1.Height=Table2.Top
这是两个表布局的示例(顶部有其他图表)
报告设计器两个表格
希望有帮助!
I use a lot of report with multiple tables, I simply Add the the start of the second table exactly over the end of the second table, when rendered they appears one after the other.
So you need to configure the first table with:
And
Note that Table1.Top+Table1.Height=Table2.Top
Here is an example of two tables layout (with additional charts on top)
report designer two tables
Hope it helps!!
这些表格应该一个接一个地呈现。您的 RDLC 中一定还有其他事情发生。您自己生成 RDLC 吗?您是否尝试过使用报表设计器创建一个虚拟报表,在其中放入两个表,然后检查它生成的 RDLC?一份报告中包含多个表格是非常常见的。
还可以尝试设置其
Top
元素:The tables should render one after the other. There must be something more going on in your RDLC. You are generating the RDLC yourself? Have you tried creating a dummy report with the report designer, dropping two tables in it, and examining the RDLC it generates? Multiple tables in one report is extremely common.
Also try setting their
Top
elements:天啊!只需将ZIndex=2
添加到第二个表即可轻松完成。即使
ZIndex
也不重要,设置 magic fakeTop
才是最重要的。仍然不确定 XML 中的顺序是否重要并设置不同的Top
XML 中的顺序并不重要,重要的是顶部。您必须将顶部设置为大于 Table1 顶部+高度(设计器中实际具有的高度)
OMG! It was as easy as addingZIndex=2
to the second table.Even
ZIndex
is not important, setting magic fakeTop
is all that matters.Still not sure if order in the XML is important and setting differentTop
sThe order in the XML is not important, but the Top is. You must set a top greater that Table1 top+height (that height that it virtually have in the designer)