Crystal报表页面大小 [英] Crystal report page size

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

问题描述

大家好,

在我的项目中,我有几个报告都是纸张尺寸A4,但我想只改变一个报告的大小。如何才能更改该报告的页面大小?





谢谢!

解决方案

您可以根据您的条件在运行时更改纸张尺寸。这些元素来自打印机设置。

 ReportDocument myReportDocument =  new  ReportDocument(); 
if (会话[ PaperSize].Equals( A4))
{
myReportDocument .PrintOptions.PaperSize = PaperSize.PaperA4;
}
else if (会话[ PaperSize]。等于( A3))
{
myReportDocument.PrintOptions.PaperSize = PaperSize.PaperA3;
}
DataSet MyDataSet =(DataSet)Session [ MyDataSet];
myReportDocument.SetDataSource(MyDataSet);
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DataBind();



始终附带您的代码段,这将有助于您快速获得解决方案。


< blockquote>

我的水晶报告中有自定义纸张尺寸8.5 * 6.00的问题。我在VS 2008中开发并且它在我的本地工作正常但在我在II7服务器2008中部署其默认字母大小后,我的自定义大小代码如下,







System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();

int rawKind = 0 ;

for(i = 0; i< = doctoprint.PrinterSettings.PaperSizes.Count - 1; i ++)

{

if( doctoprint.PrinterSettings.PaperSizes [i] .PaperName ==" DC")

{

rawKind =

Convert.ToInt32(doctoprint。 PrinterSettings.PaperSizes [i] .GetType()。GetField(" kind",System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes [i]));

//休息;

//}

//}

rawKind = GetPaperSizeID();

rpt.PrintOptions.PaperSize =(CrystalDecisions.Shared.PaperSize)rawKind;

CrystalReportViewer1.ReportSource = rpt;


报告的页面大小来自于报告的打印机设置。您可以在打印机设置中更改此设置。



为了清晰起见,请查看这些内容。建议:

链接1 [ ^ ]

Link 2 [ ^ ]

链接3 [ ^ ]


Hi all,
In my project I have several reports that are all paper size A4, but I want to change that size for only one report. How can I change page size for that one report only?


Thank you!

解决方案

You can change the paper size at runtime based on your condition. The elements are derived from Printer settings.

ReportDocument myReportDocument = new ReportDocument();
if(Session["PaperSize"].Equals("A4"))
{
myReportDocument.PrintOptions.PaperSize = PaperSize.PaperA4;
}
else if(Session["PaperSize"].Equals("A3"))
{
myReportDocument.PrintOptions.PaperSize = PaperSize.PaperA3;
}
DataSet MyDataSet = (DataSet)Session["MyDataSet"];
myReportDocument.SetDataSource(MyDataSet);
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DataBind();


Always come with your snippets which will help you to get solutions quickly for you.


Hi ,
I have problem of Custom paper size 8.5*6.00 in my crystal report. I have developed in VS 2008 and it working fine in my local but after i deploy in II7 server 2008 its taking default letter size, my code for custom size is as below,



System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();
int rawKind = 0;
for (i = 0; i <= doctoprint.PrinterSettings.PaperSizes.Count - 1; i++)
{
if (doctoprint.PrinterSettings.PaperSizes[i].PaperName == "DC")
{
rawKind =
Convert.ToInt32(doctoprint.PrinterSettings.PaperSizes[i].GetType().GetField("kind", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes[i]));
// break;
// }
//}
rawKind = GetPaperSizeID();
rpt.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
CrystalReportViewer1.ReportSource = rpt;


The page size of the report is derived from the printer settings of the report. You can change this in the printer setup.

Have a look at these for clarity & suggestions:
Link 1[^]
Link 2[^]
Link 3[^]


这篇关于Crystal报表页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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