gpt4 book ai didi

使用 GroupStyle 时 WPF 多页 Listview 打印

转载 作者:行者123 更新时间:2023-12-04 14:14:37 38 4
gpt4 key购买 nike

我编写了一个 ListView使用 xaml,mvvm 报告,它工作得很好。
xaml 代码部署 ListView.GroupStyle生成的报告有一个组标题、项目列表和组总计和计数。
它看起来像这样:
enter image description here

我想将同样的报告打印到打印机上。它是多页的,单独的组可以跨越一页以上,具体取决于报告日期跨度。我还想在每个打印页面的顶部显示列标题。

我之前已经阅读(并练习过)将 ListView 报告打印到 FixedPage/Fixed Document 并计算每个页面的项目源以将打印的报告分布在多个页面上。

这次因为我用的是分组,问题就显得比较难了?我看不到如何计算每个页面的项目来源。我在想我需要以某种方式将报告构建为单个未绑定(bind)(无页面大小限制)ListView,取出 ListViewItems,然后使用这些项目来构建我的报告。

我已阅读 solutions using FlowDocument ,但在那里看不到答案?

谁能给我一些想法如何解决这个问题?

最佳答案

以下是您引用的 StackOverflow 链接的已接受答案中的建议:

It turned out that the flowdocument / XPS method was a completely wrong headed way of approaching this task, and in fact the built in RDLC reports allowed us to achieve everything we needed for our invoice documents, in a relatively straight forward manner.



这是我要走的路线。

这是 CodeProject 文章的链接,该文章打印带有重复标题的数据网格,这几乎就是您要问的,如果您仍想继续使用原始方法:

CodeProject - Custom Data Grid Document Paginator

在这个 StackOverflow 问题中,其他方法有几个很好的答案 -

StackOverflow - Whats the best approach to printing reporting from wpf

关于使用 GroupStyle 时 WPF 多页 Listview 打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17118442/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com