on 03-18-2009 9:06 AM
I'm using CR XI Release 2 and Visual Studion 2005.
I want to print out the report from the preview window. Is it possible to set the default printer in the print dialog?
I changed the property PrintOptions.PrinterName of the ReportDocument, but it have no affect to the presetting of the print dialog.
Have anyone an idea?
Hi,
Try with this:
crReportDocument.PrintOptions.PrinterName ="\\ " ;
crReportDocument.PrintToPrinter(1, true, 1, 1);
We can set default Printer from Crystal Report design:
Go to File-> Page Setup.
Or if you are printing through code set the No Printer option in Crystal Report Designer
In Reports designer. Go to File|Page Setup and set the printer to "No Printer". Save the report.
You can download samples from [here|https://www.sdn.sap.com/irj/boc/samples]
Regards,
Shweta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shweta,
thank you very much for your answer.
But I don't output the report by calling PrintToPrinter.
First I output the report to a window by using the class CrystalReportViewer.
Then I click the print-button in the preview window and the print dialog appears.
In this print dialog you can choose the printer in a combobox.
And my requirement is: To preset the printer in the print dialog.
Regards
Andreas
Hi Andreas,
From the description, if I can understand correctly, you are previewing the report within Visual Studio itself (by clicking Main Report Preview tab). Am I correct ?
If thats true, then you will need to set the default printer from the Control Panel | Printers options.
Just previewing the report in the visual studio will not be calling the printer code; unless you build and run the application and then try to print.
Hope it helps !
Ranjeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only way I can think of getting the default printer in the print dialog, is to design the report with a default printer driver. E.g.; if the report was created with a non default printer, that printer will be looked for by the report and that specific printer driver ( if found) will be at the top of the list box in the printer dialog. If that specific printer driver is not found, a default printer driver should be substituted.
Ludek
Hi Ludek,
I created a report with a non default printer.
When I'm calling the print function in "Crystal Reports Designer", it works well: The printer assigned to the report is preselected in the print dialog.
But when I'm calling the print function in the CR-preview window, the default printer is preselected.
Is it possible to change this behaviour at runtime?
Andreas
Ahhh, crickets... Forgot about this one being a known issue that I actually tracked and submitted to QA for a resolution on March 3rd. I also wrote a note on this, but it does not appear to have been published yet. In any case, here is the content of the note:
Symptom
At runtime, in a Visual Studio .NET application, a specific printer driver set when the report was created is ignored and the report substitutes a default printer driver
Reproducing the Issue
Create a report in the Crystal Reports Designer
Set a specific printer driver; Go to the File menu, select "Page Setup" and choose a non-default printer driver
Run the report in a Visual Studio .NET application
Once the report is displayed in the viewer, click on the Print button
The printer driver highlighted in the "Print" dialog is the default printer driver, not the specific printer driver set in the report at design time
Resolution
Technical Escalation number 5000075601 has been created and assigned to QA for a resolution
So, that's the "good" news. The bad news is that these issues typically take 6+ months to resolve - if they are accepted by R&D. Service Packs and Fix Packs are posted here:
https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm
Ludek
No it is not. Unfortunately, you'll have to visit the downloads page every so often and see if an update has been posted for your version of CR. Download that update, and see if it resolves the issue. I do keep track of issues I have escalated with the forum link attached, so when a patch / update comes in I will try to post to the link. Please note that normally, issue resolutions do take about 6 months or more.
Ludek
Hi,
This problem also affect all the printing options of the default printer?
If you change the default settings for a printer (default or not) in the printer properties these settings aren't taken in consideration by the print dialog of the CR-preview window.
For example, it always sets the printer paper size to Letter.
Or is there a way to change it (even if it choses the default printer).
Thanks.
Hi
Try this code -
boReportDocument.PrintOptions.PrinterName = "\\NetworkName\PrinterName"
'Send to Printer
boReportDocument.PrintToPrinter(False, 0, 1, 1)
'CrystalReportViewer1.ReportSource = boReportDocument
'MessageBox("Registration Form is printed on PrinterName Printer")
Else
MessageBox("Check Printer settings")
End If
Also open the report in the CR Designer and uncheck the "Default Printer" option.
Hope this will help!!
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.