如何在断开检查条件的while循环中放置分页符(在C#打印文档中) [英] How do I put page break (in C# print document) inside a while loop checking a condition

查看:152
本文介绍了如何在断开检查条件的while循环中放置分页符(在C#打印文档中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用C#print方法(e.Graphics.Drawstring)来打印报告。有一个while循环,每行都打印一行。如果行数超过100行,我应该在每个页面中打印25行,每页中都有相同的标题列。如果有任何示例代码请帮帮我。



提前谢谢。

Hi,
I am using C# print method (e.Graphics.Drawstring) to print a report. There is a while loop in which each row is printed. In case there is more than 100 rows I should print 25 rows in each page with the same header columns in each page. Please help me if any have a sample code for this.

Thank you in advance.

推荐答案

我建议你看一下这篇文章:绝对的初学者指南用.NET打印 [ ^ ]



你需要做的就是不要把你的分页放在一个循环中而是编码你的
I suggest you look at the article: An absolute beginner's guide to printing in .NET[^]

What you need to do is not put your page break in a loop but rather code your
_PrintPage

处理程序打印25行,然后将e.HasMorePages设置为true,如果还有剩余行要打印。

handler to print 25 rows and then to set e.HasMorePages to true if there are any more rows left to print.


这篇关于如何在断开检查条件的while循环中放置分页符(在C#打印文档中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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