I create a Receipt Report by Xtrareport it work properly, what I need is:
vb.net code to print the report directly when pressing the Print Button without showing the preview report.
Use the ReportPrintTool class to create an instance of a report and immediately send it to a printer.
The Print a Report documentation offers sample code showing how to directly print a report using the ReportPrintTool.Print method. For instance:
Dim report As New XtraReport1()
Dim printTool As New ReportPrintTool(report))
' Invoke the Print dialog.
printTool.PrintDialog()
' Send the report to the default printer.
printTool.Print()
Related
I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.
I don't want to save the label, I just want it to print directly after the system has created it.
Dim ap9 As craxdrt.Application
Dim rpt9 As craxdrt.Report
Dim dbt As craxdrt.DatabaseTable
Set ap9 = New craxdrt.Application
On Error GoTo errError2
Set iniFile = New CIniFile
On Error GoTo errError3
Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
On Error GoTo errError4
For Each dbt In rpt9.Database.Tables
dbt.Location = iniFile.pathDbCosmet
If dbt.ConnectionProperties.count <= 5 Then
dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
End If
Next
rpt9.RecordSelectionFormula = sFormula
rpt9.PrintOut False, CInt(txtPacksReceived.Text)
The following code allows me to select a printer
and after clicking 'Print' at that point I am shown another dialog
However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.
Is there some reason why I'm not able to print my labels?
I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?
Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.
If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?
I am having trouble printing reports with FastReport in Delphi 2010.
When printing to the printer the first time, it prints correctly, but the second time that I try to print the report does not print correctly.
Viewing on my computer is working correctly, the problem is when I will print on the printer that the problem happens.
frxReport1.LoadFromFile(FileRep);
if isPrint then begin
frxReport1.PrepareReport();
frxReport1.Print;
end else
frxReport1.ShowReport;
For exemple:
The wrong form (the first time):
The correct form (the second time):
Try to use latest FR 5.5.11. If problem still exists - create small demo project with error and send it to FR's support https://support.fast-report.com/tickets
Suppose a display file has been declared in a CL program. It accepts some user input and conducts some validations to it. If it fails the validation a message would be displayed on the bottom of the display file. Is it possible to achieve this in CL? I have tried SNDPGMMSG with MSGTYPE(*DIAG), but the message is displayed only after the program has been terminated, and not on the display file during the execution.
The message to be sent is retrieved from message file so using field to display message is not applicable.
Normally we use message subfile to achive what you required above.
It can be done in display file for both CL and RPG
For CL example, you could read here http://www.mcpressonline.com/cl/the-cl-corner-letting-the-user-know-what-s-right-and-wrong.html.
You could search for "cl program message subfile" for other examples
Define a 75 character field in your display file DDS. Call it MESSAGE. In your CL do something like:
if (&option *ge '35') do
CHGVAR &MESSAGE 'Invalid option chosen'
goto getOption
enddo
I'm working on an issue with a Crystal report (Crystal XI running in a VB app) where a sporadic "Missing parameter values" error is received when trying to print the report directly. Here's a summary of the issue:
User runs the report via the report menu (everything works fine)
User clicks 'Print Preview' (everything works fine)
User clicks 'Print' (supposed to send the document directly to the printer, but sometimes get missing parameter error)
Here is what I had for code to start:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
Based on what I've been googling, I came up with this code:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
'here are my attempts to get it to work
Dim pf As ParameterFields = report.ParameterFields
report.PrintOptions.PrinterName = "Microsoft XPS Document Writer"
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
I'm about out of ideas on how to solve this issue. Has anyone else run across this?
Start Code: You problably have some empty parameter in your report.
After Search Code: You have this line:
Dim pf As ParameterFields = report.ParameterFields
You have a parameter, and you are not setting any value.
For both, use:
//[C#]
report.setParameterValue(parameterName, parameterValue);
It's very simple. Make sure that all of your parameters inside the report are filled and thrown data before using "printtoprinter". I have solved it with that.
As far as I can tell, this looks like an issue in Crystal. I couldn't find a fix, so I'm just using a workaround until a fix is available (report is generated and then printed manually).
First you need to add PrintDialog from toolBox
then add the following code button_click_event
ReportName.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName
ReportName.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Landscape
ReportName.PrintOptions.PrinterName = "Microsoft XPS Document Writer"
ReportName.PrintToPrinter(PrintDialog1.PrinterSettings.Copies, True, 1, 99)
This would send printing directly to "Microsoft XPS Document Writer". vote if you found this helpful
I'm using FastReport in Delphi Win32.
When a FastReport is called, it is previewed before you can print it.
The user sometimes needs to print a series of reports. It's a PITA to preview then print each one separately.
How can I queue the reports and send them directly to the default printer?
Just call PrepareReport followed by Print. You don't have to show the preview.
frxReport1.PrepareReport;
frxReport1.Print;
It's written in developper help file (Programmer Manual) Chapter "Building a composite report (batch printing)"
frxReport1.LoadFromFile('1.fr3');
frxReport1.PrepareReport;
frxReport1.LoadFromFile('2.fr3');
frxReport1.PrepareReport(False);
frxReport1.Print;