使用ItemsControl打印多页FlowDocument [英] Print Multipage FlowDocument with ItemsControl

查看:71
本文介绍了使用ItemsControl打印多页FlowDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FlowDocument打印巨大的TreeView.为了实现这一点,我向Flow文档中添加了多个HierarchicalDataTemplates并生成页面,我只需将DataContext设置为TreeView的DataContext.当我显示此文件时 使用FlowDocumentScrollViewer看起来很完美,但是当我要打印FlowDocument时,由于我用来显示项目的ItemsControl,我总是只能得到一个页面.看来FlowDocument的DocumentPaginator无法打印 对多个页面的单一控制.有谁知道这个问题的解决方案?

I'am trying to print a huge TreeView using a FlowDocument. To achieve this I've added multiple HierarchicalDataTemplates to the Flowdocument and to generate the page I simply set the DataContext to the DataContext of the TreeView. When I display this document with an FlowDocumentScrollViewer it looks perfect, but when I want to print the FlowDocument I allways get only a single page because of the ItemsControl I am using to display the items. It seems that the DocumentPaginator of the FlowDocument cannot print a single control over multiple pages. Does anyone knows a solution for this problem?

推荐答案

The NetStriker,您好,

请提供一些代码给我们看看您是如何实现DocumentPaginator的?

PrintVisual打印任何Visual,但不能打印在页面之间拆分视觉效果.如果您希望多页打印屏幕上看到的内容,则需要实施 DocumentPaginator,然后使用PrintDialog.PrintDocument.分页器可能不得不重用视觉效果+翻译和剪切它们以模拟跨页面的断裂. 

PrintVisual prints any Visual but cannot split Visuals across pages. If you want multi-page printing of what you see on screen you'll need to implement a DocumentPaginator and use PrintDialog.PrintDocument. The paginator probably has to reuse visuals + translate and clip them to simulate breaking across pages. 

有关更多信息,请查看此线程:

http://social.msdn.microsoft.com/Forums/zh-CN/wpf /thread/8ebb07af-253b-46f5-949d-5230ecc1b53c/

如果您仍然有任何疑问或疑虑,请随时让我知道!

最好的提示


这篇关于使用ItemsControl打印多页FlowDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆