Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How do i assign changed printer settings to a report

edited May 2004 in General
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;

Comments

  • edited May 2004
    Hi Filip,

    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.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.