为visual studio 2010中的报表查看器设置页面布局 [英] set page layout for report viewer in visual studio 2010

查看:928
本文介绍了为visual studio 2010中的报表查看器设置页面布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我又有一个小问题。
我在Visual studio 2010中的Windows窗体应用程序中使用了ReportViewer。我的报告宽度大约为7英寸。当我在打印布局中查看报告时,报告在页面上被切割,即,只有一半的内容在页面上,并且休息是在右边缘和页面边界之外。然后我必须在报表查看器顶部菜单中单击页面设置更改页面设置,我只是将左右边距从每个1减少到0.25。

I again have a little problem. I have used ReportViewer in my Windows Form Application in visual studio 2010. The width of my report id about 7 inches. When i view the report in print layout, the report is cut across the page,i.e, only half of the content is on the page and rest is out of right margin and page boundary. I then have to click page setup in the report viewer top menu to change page setup, i just reduce left and right margins to 0.25 from 1 each.

我不想每次查看和打印报告时都这样做。有没有办法在C#中以编程方式更改这些设置或更改默认页面布局?

I don't want to do it every time I view and print a report. Is there a way to change these setting programmatically in C# or change the default page layout?

推荐答案

/ p>

you can use below code:

 System.Drawing.Printing.PageSettings pg=new System.Drawing.Printing.PageSettings();
 pg.Margins.Top = 0;
 pg.Margins.Bottom = 0;
 pg.Margins.Left = 0;
 pg.Margins.Right = 0;
 System.Drawing.Printing.PaperSize size = new PaperSize();
 size.RawKind = (int)PaperKind.A5;
 pg.PaperSize = size;
 reportViewer1.SetPageSettings(pg);
 this.reportViewer1.RefreshReport();

这篇关于为visual studio 2010中的报表查看器设置页面布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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