My 2 crystal questions...

dreamtime

Active member
Joined
May 13, 2005
Messages
26
Programming Experience
1-3
Version: visual basic .net (visual studio) with bundled Crystal Reports

I have tried to find answers to these questions and hope that someone may be able to help!

1) I need to add images to a report at run time. I do not wish to use a database - I am therefore trying to use CRAXDDRT20 reference instead (as suggested elsewhere). eg (example code, not formatted correctly)

Dim crAppl As New CRAXDDRT20.Application
Dim report As New CRAXDDRT20.Report
report = crAppl.OpenReport("c:\testreport.rpt")
'image code here
ReportViewer.ReportSource = report

I get an error on the last line - is there a way to set the report viewer to a report loaded using CRAXDDRT20? Is there a better way to add images at runtime using .net?

2) I have each page of the report (currently) in seperate files. This may change in the future, but this is the case at this point in time (there is a reason for this even if it doesn't make sense!). Is there a way programmatically to load these all into one report document at runtime (and hence viewer)? ie. page/section 1 = "c:\page1.rpt" page/section 2 = "c:\page2.rpt". The content/pages change with certain variables. Each page will have different data on it. My aim is to send 1 print job to the printer instead of 25+.

Thank you for your time.
 
Last edited:
More detail on question 2.

The main reason for trying to bring the reports together is due to an issue with printing which has come to light. My app effectively send the reports to the printer separately. So to print a 'complete' report (for a specific person), 25 print jobs get sent to the printer.

There seems to be some issues with slow printing. I do not suffer from this myself (using an HP 2100, 2200 and 2300), but other people do. They are using the same HP 2300 laser printer and some new models. They should all roughly print 20ppm. I get about 14ppm out of the 2300 on A5 with graphics which is fine. Other users, on the same printer model (but in a separate place) are getting 4 - 8ppm. The total number of print jobs reaches 500-600 so speed is important. In other users, the printer seems to pause between print jobs. On my 2300, it effectively prints one sheet after the other with no discernible pause between sheets. I have altered resolution, paper size, etc to try and remove this problem for other users but to no avail. I seem to be using the same driver (2300 from the HP site). Both are using win XP. Both are on SP2. Both are connected using USB.

So my idea was to band the reports into one print job. Instead of 300 separate jobs I could send 10 jobs of 30 sheets. I hope that makes sense. The thought was the printer is taking time to prepare each separate job (although why it doesn’t do this on mine so noticeably is a mystery). I use the ‘report.printtoprinter’ routine.

Does anyone have any knowledge on ways to improve print speed. I noticed that the driver is using its own print processor (HPZ….can’t remember completely) instead of WinPrint (does this make a difference?). They are both set to spool and to print immediately. Because I need dynamic graphics I have to use bitmaps from an access database. I am trying to find a way to use dynamic jpgs. I am not sure this would make it quicker though. Obviously, the reports are spooled well in advance of the printer being ready to print.

An alternative question would be .. is there a way to output the report directly to another form/component/cache utilising pages and then print that. As an example, export it to Word on seperate pages then print the Word document (I do not want to use Word - just an example).

A further problem affecting the speed is that there is no way to set print quality/resolution at run time because the printtoprinter method cannot take print settings from the .net print dialog. If I show a print dialog and printtoprinter, it defaults to the printer defaults, not what I set in the print dialog.

report.PrintOptions.PrinterName = printdoc.PrinterSettings.PrinterName
report.PrintToPrinter(PrintDialog1.PrinterSettings.Copies, False, 1, 1)

This causes a further problem in the speed issue as some of the users have the highest resolution as their printer defaults and altering it during run time in the print dialog makes no odds.

Any ideas would be really appreciated.
 
Last edited:
Back
Top