Show print dialog
Hi,
I am having some problems getting a printdialog to show with the code below.
This report is done entirely in code. We make the report templates, store
them in a database and print directly from there. How can I get a print
dialog to show? Any help would be great!
Thanks,
Jada
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//////////////
procedure TformProposalUI.PrintMedicalProductGrid;
// printing the report templates as one print job
var
lPrinterDevice : TppPrinterDevice;
integerX : integer;
begin
integerReportNo := 1;
lPrinterDevice := TppPrinterDevice.Create(self);
lPrinterDevice.PageSetting := psAll;
FreportTemp.SavePrinterSetup := True;
lPrinterDevice.StartPrintJob := True;
lPrinterDevice.EndPrintJob := False;
for integerX := 0 to
formdatamoduleQuoteOutput.tableReportTemplates.RecordCount - 1 do
begin
FreportTemp.Template.DatabaseSettings.Name := 'ReportPage' +
inttostr(integerReportNo) + 'Template';
FreportTemp.Template.LoadFromDatabase;
lPrinterDevice.Publisher := FreportTemp.Publisher;
if integerX = 0 then
begin
FreportTemp.ShowPrintDialog := True;
FreportTemp.PrintToDevices;
end
else
begin
FreportTemp.ShowPrintDialog := False;
FreportTemp.PrintToDevices;
end;{if integerX = 0 then}
inc(integerReportNo);
lPrinterDevice.StartPrintJob := False;
end;
lPrinterDevice.EndPrintJob := True;
lPrinterDevice.Free;
end;{PrintMedicalProductGrid}
I am having some problems getting a printdialog to show with the code below.
This report is done entirely in code. We make the report templates, store
them in a database and print directly from there. How can I get a print
dialog to show? Any help would be great!
Thanks,
Jada
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//////////////
procedure TformProposalUI.PrintMedicalProductGrid;
// printing the report templates as one print job
var
lPrinterDevice : TppPrinterDevice;
integerX : integer;
begin
integerReportNo := 1;
lPrinterDevice := TppPrinterDevice.Create(self);
lPrinterDevice.PageSetting := psAll;
FreportTemp.SavePrinterSetup := True;
lPrinterDevice.StartPrintJob := True;
lPrinterDevice.EndPrintJob := False;
for integerX := 0 to
formdatamoduleQuoteOutput.tableReportTemplates.RecordCount - 1 do
begin
FreportTemp.Template.DatabaseSettings.Name := 'ReportPage' +
inttostr(integerReportNo) + 'Template';
FreportTemp.Template.LoadFromDatabase;
lPrinterDevice.Publisher := FreportTemp.Publisher;
if integerX = 0 then
begin
FreportTemp.ShowPrintDialog := True;
FreportTemp.PrintToDevices;
end
else
begin
FreportTemp.ShowPrintDialog := False;
FreportTemp.PrintToDevices;
end;{if integerX = 0 then}
inc(integerReportNo);
lPrinterDevice.StartPrintJob := False;
end;
lPrinterDevice.EndPrintJob := True;
lPrinterDevice.Free;
end;{PrintMedicalProductGrid}
This discussion has been closed.
Comments
You can instantiate and display the dialog in code though.
See the PrintToPrinter method in ppProd.pas for an
example...
http://www.digital-metaphors.com
info@digital-metaphors.com