Board index » delphi » How to set Quickreport properties to TPrinter properties

How to set Quickreport properties to TPrinter properties

I am trying to set the properties (eg orientation) of a newly created
QuickReport to those of the selected printer in the global Delphi TPrinter
object.

I have managed to set the global QRPrinter.PrinterIndex correctly to reflect
the selected printer in Printer, but nothing of the following works -
although when I investigate the orientation variable it actually is
poLandscape!

var    TQR :TQuickRep;

QRPrinter.PrinterIndex :=
GetPrinterIdx(Printer.Printers.Strings[Printer.PrinterIndex]);
QRPrinter.Orientation := Printer.Orientation;
QRPrinter.Copies := Printer.Copies;

TQR := TqrConfigList.Create(self)
...
try
    TQR.PrinterSettings.PrinterIndex := QRPRNTR.QRPrinter.PrinterIndex;
    TQR.PrinterSettings.Orientation := QRPRNTR.QRPrinter.Orientation;
    TQR.PrinterSettings.Copies := QRPRNTR.QRPrinter.Copies;
    if fPreview then
      TQR.Preview
    else
      TQR.Print;
finally
    TQR.free;
end

I also tried setting the properties in the BeforePrint event with no
success:

procedure TqrConfigList.qrConfigListBeforePrint(Sender: TQuickRep;
  var PrintReport: Boolean);
begin
QRPRNTR.QRPrinter.PrinterIndex :=
GetPrinterIdx(Printers.Printer.Printers.Strings[Printer.PrinterIndex]);
QRPRNTR.QRPrinter.Orientation := Printers.Printer.Orientation;
QRPRNTR.QRPrinter.Copies := Printers.Printer.Copies;
Sender.PrinterSettings.PrinterIndex := QRPRNTR.QRPrinter.PrinterIndex;
Sender.PrinterSettings.Orientation := QRPRNTR.QRPrinter.Orientation;
Sender.PrinterSettings.Copies := QRPRNTR.QRPrinter.Copies;
Sender.QRPrinter.PrinterIndex := QRPRNTR.QRPrinter.PrinterIndex;
Sender.QRPrinter.Orientation := QRPRNTR.QRPrinter.Orientation;
Sender.QRPrinter.Copies := QRPRNTR.QRPrinter.Copies;
end;

But regardless of all the above it always prints Portrait!

 

Re:How to set Quickreport properties to TPrinter properties


See my reply to Tom on 10-8-98 titled "Re: How to print to a specified
paper-tray with QReport?".  There are 2 attached files that will help you
out.
--

Scott

Lize van den Heever <l...@acuity.co.za> wrote in message
news:6vvfmb$fsq7@forums.borland.com...

Quote
>I am trying to set the properties (eg orientation) of a newly created
>QuickReport to those of the selected printer in the global Delphi TPrinter
>object.

>I have managed to set the global QRPrinter.PrinterIndex correctly to
reflect
>the selected printer in Printer, but nothing of the following works -
>although when I investigate the orientation variable it actually is
>poLandscape!

Other Threads