RDLC:如何在一份报告中打印多个表格

发布于 2024-08-30 18:55:28 字数 548 浏览 10 评论 0原文

我正在生成 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

度的依靠╰つ 2024-09-06 18:55:28

我使用大量带有多个表格的报告,我只需将第二个表格的开头恰好添加到第二个表格的结尾处,渲染时它们会一个接一个地出现。
因此,您需要配置第一个表:

<Table Name="table1">
<DataSetName>DataSets_ChiamateGroup</DataSetName>
<KeepTogether>true</KeepTogether>
<Top>36cm</Top>
<Height>3.00001cm</Height>

<Table Name="table2">
<DataSetName>DataSets_ChiamateGroup</DataSetName>
<KeepTogether>true</KeepTogether>
<Top>39cm</Top>
<Height>5.00000cm</Height>

注意 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:

<Table Name="table1">
<DataSetName>DataSets_ChiamateGroup</DataSetName>
<KeepTogether>true</KeepTogether>
<Top>36cm</Top>
<Height>3.00001cm</Height>

And

<Table Name="table2">
<DataSetName>DataSets_ChiamateGroup</DataSetName>
<KeepTogether>true</KeepTogether>
<Top>39cm</Top>
<Height>5.00000cm</Height>

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!!

栖迟 2024-09-06 18:55:28

这些表格应该一个接一个地呈现。您的 RDLC 中一定还有其他事情发生。您自己生成 RDLC 吗?您是否尝试过使用报表设计器创建一个虚拟报表,在其中放入两个表,然后检查它生成的 RDLC?一份报告中包含多个表格是非常常见的。

还可以尝试设置其 Top 元素:

        <Table Name="Table1">
            <Top>1in</Top>
        </Table>
        <Table Name="Table2">
            <Top>5in</Top>
        </Table> 

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:

        <Table Name="Table1">
            <Top>1in</Top>
        </Table>
        <Table Name="Table2">
            <Top>5in</Top>
        </Table> 
匿名的好友 2024-09-06 18:55:28

天啊!只需将 ZIndex=2 添加到第二个表即可轻松完成。
即使 ZIndex 也不重要,设置 magic fake Top 才是最重要的。

<Body>
    <ReportItems>
            <Table Name="Table1">
                 <Top>1cm</Top> 
                 ....
            </Table>
            <Table Name="Table2">
                 <Top>2.25cm</Top> <!-- more than table1 Top + Height -->
                 ....
            </Table>           
    </ReportItems>
</Body>

仍然不确定 XML 中的顺序是否重要并设置不同的 Top
XML 中的顺序并不重要,重要的是顶部。您必须将顶部设置为大于 Table1 顶部+高度(设计器中实际具有的高度)

OMG! It was as easy as adding ZIndex=2 to the second table.
Even ZIndex is not important, setting magic fake Top is all that matters.

<Body>
    <ReportItems>
            <Table Name="Table1">
                 <Top>1cm</Top> 
                 ....
            </Table>
            <Table Name="Table2">
                 <Top>2.25cm</Top> <!-- more than table1 Top + Height -->
                 ....
            </Table>           
    </ReportItems>
</Body>

Still not sure if order in the XML is important and setting different Tops
The 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文