473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Crystalviewer PrintReport()

We have a series of reports for a new application. As part of the process
flow, these reports should be generated and printed at the conclusion of the
transaction. Prior to this requirement, each report, in turn, were
displayed in the CrystalViewer and manually printed by the user.

We stopped passing the reports through the viewer and simply executed the
PrintToPrinter() method. For the most part this is fine, except that on a
couple reports, the calculated fields on the far right of the document are
truncated. I had thought that I had inadvertantly fat fingered something,
and on a lark ran the report through the viewer again in an attempt to save
paper, thinking that I would see WYSIWYG results. The viewer was fine so I
printed the report. The report was fine.

Needless to say after much testing, it does appear that the Viewer properly
sends the report out to the printer, while sending report directly to the
printer does not have the desired results.

We then decided to use the viewer and simply call the PrintReport() method.
This is obviously wrong, since it throws exception. (Unable to send the
report to the printer:System.ArgumentException: '-1' is not a valid value
for 'value'. 'value' must be greater than or equal to 0.) There are a
series of reports that need to be printed, a printer should be selected only
once.
Code to get there:
'objReport is CrystalDecisions.CrystalReports.Engine.ReportDocum ent
'viewer is CrystalDecisions.Windows.Forms.CrystalReportViewer
'Printer is Drawing.Printing.PrinterSettings and PrinterName is set

Try

objReport.PrintOptions.PrinterName = Printer.PrinterName
'I would prefer to call this
'objReport.PrintToPrinter(Copies, True, 0, 0)

viewer.ReportSource = objReport
viewer.PrintReport()

Catch ex As Exception
'...
End Try

We must either figure out a way to use the PrintToPrinter() of the report
document or the PrintReport() of the viewer. OLE Automation of Office
products is not an option, nor are HTML, XML/CSS viable solutions. Crystal
has to be the end solution.

VS.Net 2003, integrated crystal reports for .Net
..Net Framework 1.1 sp1

Thanks in advance.

Nov 30 '05 #1
0 1982

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: N.Naeem | last post by:
CrystalReport1.PrintReport returns 532 What error is this? thanks
2
by: Raul Medina | last post by:
I am trying to print the same visual basic report multiple times in my VB 6.0 application using the command <reportObject>.printReport False, rptRangeAllPages. The only thing that differs between...
2
by: Japie Niemand | last post by:
Hi, I have created a UserControl with the CrytalReport viewer. When I run the app and use this UC the Crystalviewer have no images in the toolbar. I have tried by instantiating the Cruysterviewer...
0
by: Robrecht | last post by:
Hi I'm using following code to print a report. On Error Resume Next Dim rsetiket As ADODB.Recordset Dim conn As ADODB.Connection Set conn = New ADODB.Connection Set rsetiket = New...
0
by: rik | last post by:
im using CrystalViewer in an asp.net web application and pushing a dataset to it. it works fine and displays just fine. however when i export it and it has multiple pages, it only exports the very...
0
by: VBCoder | last post by:
When running the program, when I call the PrintReport method on a DataReport having already viewed the report, another copy of the report opens up but with some of the header data missing. Has...
0
by: kjohnston via DotNetMonster.com | last post by:
Created a single form with one TabControl and a Crystal Reports XI viewer on it. The application displays one to many reports from the form as necessary. In order to accomplish this, the...
1
by: stan.goodvibes | last post by:
Hi there, I've got VB Express installed and working. I downloaded the evaluation copy of Crystal Reports Developer Edition XI, that works fine as well. In VB I went to Tools->Choose Toolbox...
2
by: kutsaratinidor | last post by:
hi to all im currently having problems with datareport in vb6..i assigned a recordset as a datareport's datasource..and telling it to be printed once a button is clicked..my problem is that when...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.