我遇到了一个问题,我想打印一份收据尺寸为3 x 4厘米的报告。我无法调整水晶报告的大小。我正在使用visual studio.net 2008的水晶报告。
谢谢
答案 0 :(得分:1)
有时Crystal Reports会发生这种情况。我之前遇到过同样的问题,并成功尝试了这段代码。你也试试这个并告诉我发生了什么......
Dim doctoprint As New System.Drawing.Printing.PrintDocument()
doctoprint.PrinterSettings.PrinterName = "YourPrinterName" '(ex. "Epson SQ-1170 ESC/P 2")
For i = 0 To doctoprint.PrinterSettings.PaperSizes.Count - 1
Dim rawKind As Integer
If doctoprint.PrinterSettings.PaperSizes(i).PaperName = "MyCustomFormatName" Then
rawKind = CInt(doctoprint.PrinterSettings.PaperSizes(i).GetType().GetField("kind", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes(i)))
oRpt.PrintOptions.PaperSize = rawKind
Exit For
End If
Next