How do i assign changed printer settings to a report
Hi,
We use TPrinterSetupDialog form to change current printer settings
(Orientation, bins), when changed how do i assign the changed settings back
to the report. Below is the code i'm using trying to get it to work.
Thx,
Filip Moons
// Choose Printer
Printer.PrinterIndex := ChosenPrinter;
// Modify printer settings
PrinterSetupDialog.Execute;
// Assign printer to report
MyReport.PrinterSetup.PrinterName :=
Printer.Printers[Printer.PrinterIndex];
// Assign printer settings to report
lPrinter := TppPrinter.Create;
try
lPrinter.PrinterName := MyReport.PrinterSetup.PrinterName;
rptLYVAL.PrinterSetup := lPrinter.PrinterSetup;
finally
lPrinter.Free;
end;
We use TPrinterSetupDialog form to change current printer settings
(Orientation, bins), when changed how do i assign the changed settings back
to the report. Below is the code i'm using trying to get it to work.
Thx,
Filip Moons
// Choose Printer
Printer.PrinterIndex := ChosenPrinter;
// Modify printer settings
PrinterSetupDialog.Execute;
// Assign printer to report
MyReport.PrinterSetup.PrinterName :=
Printer.Printers[Printer.PrinterIndex];
// Assign printer settings to report
lPrinter := TppPrinter.Create;
try
lPrinter.PrinterName := MyReport.PrinterSetup.PrinterName;
rptLYVAL.PrinterSetup := lPrinter.PrinterSetup;
finally
lPrinter.Free;
end;
This discussion has been closed.
Comments
ReportBuilder does not use Delphi's TPrinter object to print reports, is
uses it's own TppPrinter object. The first mistake I see with your code
below is when you are trying to assign the printer to the report. The
PrinterSetup.PrinterName is probably not going to be the same as what the
Printer.Printers[] list returns. This would be the first place I would look
at to debug this code. You could possibly use the
TppPrinterSetup.PrinterNames TStrings property to get the proper names of
each printer that ReportBuilder can recognize.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com