打印时为Crystal Reports设置自定义纸张大小 [英] Setting Custom Paper Size for Crystal Reports while Printing

查看:751
本文介绍了打印时为Crystal Reports设置自定义纸张大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印一份水晶报告纸张尺寸=法律 &纸张方向=风景。我希望在打印对话框打开时,它应该以我的首选设置打开,打印时,应根据提供的设置进行打印。如果可能的话,请帮我显示要打印的页面范围,即我想要与水晶报表的默认打印按钮完成相同的工作。

I want to print a crystal report with Paper size = Legal & Paper Orientation = Landscape. I want that when the print dialogs opens, it should open with my preferred settings and when printed, it should be printed according to the provided settings. And if possible please help me to show page ranges to print i.e. I want exactly the same work done by the crystal report's default print button.

推荐答案

用于设置纸张尺寸

For Setting Paper Size
MYCRYSTALREPORT crpt = new MYCRYSTALREPORT();

crpt.SetDataSource(SOMEDATASET);

MYCRYSTALREPORT crpt2 = crpt; //crpt2 will only keep page size

crpt.PrintOptions.PrinterName = "PRINTERNAME";

crpt.PrintOptions.PaperSize = crpt2.PrintOptions.PaperSize;

crpt.PrintToPrinter(1,false,0,0);


用于设置边距

For Setting Margins
Dim oRpt As New rptMyReport()

oRpt.SetDataSource(dsMyDataset)

Dim margins As PageMargins

' Get the PageMargins structure and set the

' margins for the report.

margins = oRpt.PrintOptions.PageMargins

margins.bottomMargin = 0

margins.leftMargin = 0

margins.rightMargin = 0

margins.topMargin = 0

' Apply the page margins.

oRpt.PrintOptions.ApplyPageMargins(margins)

oRpt.PrintOptions.PrinterName = "Epson SQ-1170 ESC/P 2"

oRpt.PrintOptions.PaperSource = PaperSource.Tractor

crSubReportDocument1 = oRpt.OpenSubreport("rptMyReport2.rpt")

crSubReportDocument1.SetDataSource(dsMyDataset2)

crSubReportDocument1.PrintOptions.ApplyPageMargins(margins)

CrystalReportViewer1.ReportSource = oRpt

CrystalReportViewer1.Zoom(65)


这篇关于打印时为Crystal Reports设置自定义纸张大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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