on 04-22-2011 2:33 PM
Hi all, i have created new form and button1, on Button1 click i would like print directly my report.
This is the code:
Dim rptDocment As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocment.Load("C:\a.rpt")
Dim aPrintDialog As New PrintDialog()
If aPrintDialog.ShowDialog = DialogResult.OK Then
With aPrintDialog.PrinterSettings
rptDocment.PrintOptions.PrinterName = .PrinterName
rptDocment.PrintToPrinter(.Copies, .Collate, .FromPage, .ToPage)
End With
End If
But there is a problem: when PrintDialog show, i click on Properties of print, and i set 2 page for paper. After confirm the properties, i confirm the printdialog...... but when the paper exits on the printer there are 1 page per paper!!!!!!!!!!
Thanks for Help
Export your report to RPT format and then print from the Report Designer as a test. If you get the same results it's likely due to having the New Page after option checked on in one of your sections.
Thank you
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The report "a.rpt" (see code above) is a test report that have 2 section with the flag "New Page after"
When print dialog show, i can open the print properties. In that form i set "print in economy mode" or "black and white" but when i confirm and routine execute "PrintToPrinter" function, the paper Printed are normal (not economy or not in black and white)
If i use a crystal report viewer, and i click on print button, in print properties i set "black and white", and the paper Printed are OK (black and whte)
Thanks
Great info. So what is happening if you set some of the options it uses the default other options.
Now you need to set the color and other options in code also. If you don't see them then you'll need to either use RAS and PrintOutputController or create a new printer with those options set as default and select that printer in code.
If you need more info then we need to know what version of VS and CR you are using?
Don
It's part of RAS.
See these samples for more info on how to:
Exporting Samples (RAS)
http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
Or search here also, lots of sample code on how to.
Don
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.