如何使用ReportDocument打印报告? [英] How to print a report using the ReportDocument?
问题描述
我需要你的帮助。
< span style ="font-family:Calibri">这是我第一次使用ReportDocument组件打印报告。
我需要在准备好的表格上打印报告具有特殊尺寸(高24厘米,宽18.6厘米)。如果所需的打印机不是默认打印机,报告必须首先显示
打印对话框,以便用户选择打印机。必须立即打印报告而不进行任何页面预览。
我读了一些关于如何使用ReportDocument组件的文档,我在完成所有$后开始创建所需的报告b $ b关于尺寸,高度,宽度和边距的准备表格的测量值。
现在我的I’ m面临以下问题。
1.
转换厘米以1/100英寸为单位测量时的英寸。
1. Converting the centimeters to inch when the measurement in units of 1/100 inch.
2.
我怎么做设置页面大小和页边距。
2. How I can set the page size and page margins.
谢谢。
Public Sub PrintReport()
mpdReport = New PrintDocument
Dim newMargins As System.Drawing.Printing.Margins
newMargins = New System.Drawing.Printing.Margins(CInt(0.2), CInt(0.4), CInt(1.1), CInt(0.5))
With mpdReport
.DefaultPageSettings.Margins = newMargins
End With
With mpdPrintDialog
.AllowPrintToFile = False
.AllowSomePages = False
.AllowSelection = False
.ShowHelp = False
.ShowNetwork = False
.Document = mpdReport
If .ShowDialog() = DialogResult.OK Then
mpdReport.Print()
End If
End With
End Sub
<跨度风格=" font-family:宋体 "> <一个ID =" x_x_spPreviewLink "相对= "nofollow的" href =" http://oybo2a.bay.livefilestore.com/y1pBhu7NAXGqnToS9jd0wZ1CyzIlvBYjlukODih4wWAN4En2AtA9rIsVCt7wTon4Btf-LpS6D_S66MymQxmtdNaJYLoOBQFhCI8/ InvoiceFormLayout.jpg?PSID = 1 ">
推荐答案
Public Sub PrintReport()
mpdReport = New PrintDocument
Dim newMargins As System.Drawing.Printing.Margins
newMargins = New System.Drawing.Printing.Margins(CInt(0.2), CInt(0.4), CInt(1.1), CInt(0.5))
With mpdReport
.DefaultPageSettings.Margins = newMargins
End With
With mpdPrintDialog
.AllowPrintToFile = False
.AllowSomePages = False
.AllowSelection = False
.ShowHelp = False
.ShowNetwork = False
.Document = mpdReport
If .ShowDialog() = DialogResult.OK Then
mpdReport.Print()
End If
End With
End Sub
这篇关于如何使用ReportDocument打印报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!