WPF LISTVIEW打印问题 [英] WPF LISTVIEW Printing problem

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

问题描述

如何打印列表视图的多个记录.
PrintVisual仅提供特定尺寸或视图(一次站立的位置)的图像.

请借助printvisual或任何其他方法来帮助打印多条记录.

我是wpf的新手,请简要说明是否有人知道(我的listview与其他用户控件绑定,并根据数据大小重复此使用控件)

How can print multiple records of a listview.
PrintVisual only provide image of a specific size or view (where you stand at a time).

Please help to print multiple records with the help of printvisual or any other method.

i''m new in wpf please explain in brief if any one know(My listview binds with other user control and repeat this use control according to data size)

推荐答案

要打印多页,您只需要使用实现DocumentPaginator的类,FixedDocument是较复杂的实现之一,而FlowDocument是更简单的实现.

To print multiple pages you just need to use a class that implements DocumentPaginator FixedDocument is one of the more complex implementations, FlowDocument is a simpler one.

FlowDocument fd = new FlowDocument();
foreach(object item in items)
{
    fd.Blocks.Add(new Paragraph(new Run(item.ToString())));
}
fd.Print();


作为替代方案,有一个使用PrintDialog类的简单解决方案,如下:
As an alternative, there is a simple solution using PrintDialog class as:
PrintDialog pd = new PrintDialog();
pd.PrintDocument(fd);


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

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