| Author |
Message |
danmir
Newbie
Joined: 15 Jul 2007
Location: Mexico
Online Status: Offline
Posts: 6
|

Topic: Help with printing... Posted: 14 Sep 2007 at 10:23am |
|
Hello, this problem has haunted me for a long time, and I'm beginning to get nervous...
I'm running on windows XP, using VB 2005 and Crsytal Reports XI.
Well, I have a CrystalReportViewer embedded in a form, and I want that the user has two choices: see the report, or just send it to the printer... The CrystalReportViewer has a printReport method, but the problem is that it asks for confirmation of wich printer use.
I want to avoid this, just send it to the default printer, without prompting the user the print dialog.
Please Help!!
|
IP Logged |
|
|
|
BrianBischof
Admin Group
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
|

Posted: 14 Sep 2007 at 12:50pm |
|
I think there was a post about this a month ago. I forget what the answer was. You should search the forum to see comes up.
|
|
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
|
IP Logged |
|
danmir
Newbie
Joined: 15 Jul 2007
Location: Mexico
Online Status: Offline
Posts: 6
|

Posted: 26 Sep 2007 at 11:38am |
|
Thanks, well, I think this will do... I paste the code here so someone can have the answer:
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim prnOpts As CrystalDecisions.CrystalReports.Engine.PrintOptions
Dim ps As New PrinterSettings
repOPViewer.CrystalReportViewer1.ReportSource = repOPViewer.OPIntApo1
'here I put the report on display and all that
repOPViewer.CrystalReportViewer1.SelectionFormula = "{tblObras.Obr_intIdObra} = " & ordenProd.txtIdObra.Text
repOPViewer.CrystalReportViewer1.RefreshReport()
repOPViewer.Show()
'here I begin to print to the default printer
rpt = repOPViewer.CrystalReportViewer1.ReportSource
prnOpts = rpt.PrintOptions
prnOpts.PrinterName = ps.PrinterName
rpt.PrintToPrinter(1, True, 0, 0)
repOPViewer.Close()
Enjoy!!
|
IP Logged |
|
|
|