How to print a crystal report from OR to a network printer and with no user interaction

1,672 views
Skip to first unread message

derek dodds

unread,
Dec 14, 2012, 3:40:20 AM12/14/12
to openroa...@googlegroups.com
I am trying to get a crystal report to print to a specified network printer and not the windows default in OR2006. I have written the following simple event as an example. My external class is the Crystal Reports 8.5 Active X Designer Run Time Library and I have tried using Rep.PrinterName = '\\network printer path' after opening the report but this does not work.

Any ideas?

on click gobtn =
declare
App = crrep!Application;
Rep = crrep!iReport;
enddeclare
begin

// Set report name
ReportName = 'c:\DD\testreport.rpt';
// Open Report
Rep = App.OpenReport (:ReportName);
// Print report (true = display prompt)
Rep.PrintOut(TRUE);

end

Bodo Bergmann

unread,
Dec 14, 2012, 7:45:26 AM12/14/12
to openroa...@googlegroups.com

Hi Derek,

 

This sounds rather like a Crystal Reports question.

AFAIK, the "Report" class has a PrinterSetup method, which opens the printer setup dialog box so that the user can change printers or printer settings for the report.

It also has a SelectPrinter method, which selects a different printer for the report.

 

HTH.

 

Bodo.

--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
Visit this group at http://groups.google.com/group/openroad-users?hl=en.
 
 

derek dodds

unread,
Dec 14, 2012, 8:31:54 AM12/14/12
to openroa...@googlegroups.com
Hi Bodo,

I am trying to automate the printout and not display the print option to the user. I just want to print to the users printer path (defined in a user printer settings table within my application). I cant use the select printer method as this displays the printer settings. I have tried using ReportObject.PrinterName = 'Network printer path' but OR just skips the line with no error.

Derek.

Paul White

unread,
Dec 14, 2012, 7:59:35 PM12/14/12
to openroa...@googlegroups.com

Hi Derek,

8.5 is a pretty old version.  We’ve found problems running 8.5 with OR2006 on newer versions of Windows and recommend you move up to Crystal 10 or 11.  Here is an excerpt which prints without prompting.

 

declare

   reportCrt    = ex_crystal11!report;

   reportApp  = ex_crystal11!application;

   reportFilename = varchar(200);

   sqlQuery = varchar(1000);

   selectFormula = varchar(1000);

 

..

  reportCrt = reportApp.openreport(reportFilename ,0);

  reportCrt.sqlquerystring = sqlQuery ;

 reportCrt.recordselectionformula = selectFormula;

  reportCrt.enableparameterprompting = false;

  reportCrt.printout(false) ;

 

 

(Marketing hat on)

Peercore has developed an advanced interface which supports all crystal printing, user selections, formulas, subreports, database selection and custom column level security.  The module provides the ability to popup a dialog so the user can choose to divert the report to email, pdf, or spreadsheet or bypass the dialog entirely to print to application and user configured network and direct attached printers.  If this sounds interesting at a commercial level, please contact me directly and I will put you in touch with the right people.

(Marketing hat off)

 

cheers

 

Paul White

Peercore IT

--



Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au
 
 

Bodo Bergmann

unread,
Dec 17, 2012, 3:36:24 AM12/17/12
to openroa...@googlegroups.com

Hi Derek,

 

I’m not a Crystal Reports specialist, but what I read from documentation/web is,
that the PrinterName attribute doesn’t belong directly to the Report class, but to PrintOptions.

 

In addition, according to documentation:

Use the PrintOut method to print out the specified pages of the report to the printer selected using the SelectPrinter method.
If no printer is selected, the default printer specified in the report will be used. This method can be invoked only when in formatting idle mode.

 

That is, if you can’t use the SelectPrinter method, then it makes no sense to use the PrintOut method.

 

So, you will probably have to use PrintOptions.PrinterName instead and print the report using PrintToPrinter() method.

 

See for instance here:

http://www.codeproject.com/Articles/12280/Choosing-a-printer-when-printing-from-Crystal-Repo

 

I would recommend to test your printing with a VBScript first, then it should be easy to convert it into OpenROAD code.

 

Bodo.

 

From: openroa...@googlegroups.com [mailto:openroa...@googlegroups.com] On Behalf Of derek dodds
Sent: Freitag, 14. Dezember 2012 14:32
To: openroa...@googlegroups.com
Subject: [openroad-users] Re: How to print a crystal report from OR to a network printer and with no user interaction

 

Hi Bodo,

--

derek dodds

unread,
Dec 18, 2012, 3:02:55 AM12/18/12
to openroa...@googlegroups.com
Thanks for all the advice.

Derek.

On Friday, December 14, 2012 8:40:20 AM UTC, derek dodds wrote:
Reply all
Reply to author
Forward
0 new messages