Print a report of adoquery results - c++builder

I would like to ask how can I print or create a report of results of a query which are being displayed in a TdbGrid? I try to connect datasource of dbgrid,frxDataset and frxReport but I miss something in the proccess...I use embarcadero XE 3 if that matters. I paste th code below although I know it is not correct:
frxReport1->DataSet=frxDBDataset1;
frxReport1->Report->PrepareReport();
frxReport1->Report->ShowPreparedReport();
frxReport1->Export(PDFExport1);
Thanks in advance

Related

Printing a Crystal Report directly to printer

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?

FastReport trouble print

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

What Does ".closeopen" method of TFIBDataset Component Do?

I am using FIB Plus components with Delphi 2010, just would like to know what closeopen(true) does. I tried googling but didn't get info on it.
FIBDataSet.closeopen(true);
procedure CloseOpen(const DoFetchAll:boolean);
This method reopen TpFIBDataSet. DoFetchAll parameter specifies whether to do a full fetch of data.
This quote is from russian version of document "FIbPlus 6.4 Appendix.PDF "
Unfortunately I can not find a link to the English version of the document;

Delphi: MAPILOGON ErrorCode 1

I tried with many versions of MAPISend, but I everytime got error in one place.
The MAPILogon returns with errorcode 1.
dwRet := MapiLogon(Handle,
nil,
nil,
MAPI_DIALOG or MAPI_NEW_SESSION,
0, #MAPI_Session);
I tried with "MAPISend component", this code:
http://prog.hu/tudastar/60044-6/Delphi-Email+csatolt+file+thunderbird.html
and 2 of others.
Interesting, that Acrobat Reader CAN use the MAPI with Attach to email function, and the "Send" "In Mail" context menu also working.
I don't understand why it isn't working, in my machine (Win7) it is working fine.
Then machines where I failed have WinXP OS, and they used Thunderbird.
What I can do to successfully logon into MAPI?
THanks:
dd
I think I found the problem.
The problem, that Delphi needs a Registry value named MAPI under
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem"
If this not present, it send 1 error code to you what is the base of the confusion.
This value must be string. The sysadmin wrote DWORD, and this caused the problem.
Thanks for your help:
dd
I am using RapWare components, http://www.rapware.nl/
Hth's.
Stanko.
I'm not sure about any Delphi-specific issues, but you don't need to call MAPILogon before calling MAPISendMail. If you do, I wouldn't check the return value. That's why Acrobat Reader was working and your SMAPI client was not.

Print FastReport directly

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;

Resources