If i use the line "printers.Printer.printerindex := 1;" it seems to
change printer index OK - but contines to print to the default when i
print.
the same happens if i use the lines " QuickRep1.prepare; Quickrep1.QRPri
nter.PrinterIndex := 1; "
any ideas?
JG
----------------
Jonathan Gibson
jgi...@nisoft.co.uk www.nisoft.co.uk
NiSoft (UK) Limited
Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
According to the
QUICK REPORT FAQ SHEET:
Q: How do I print to a printer different than the Windows
default printer?
A: Set QuickRep.PrinterSettings.PrinterIndex to a value corresponding
to the printer you want to print to. This value is the same as for
the Delphi TPrinter.PrinterIndex. Set to -1 to print to the default
printer again
I have tried this however, and it does not work!!! (I have QR 2.0K version
with Delphi 3 w/o source code...). The only solution I have now is to
temporarily change the default printer before printing and then change it
back after the form has printed. You can change the default printer by the
below code. But, I don't recommend doing it. Right now we currently have
one application that is doing this and now I am writing a second application
with QuickReports which will run on the same computer and I am very worried
about conflicts!
If anyone has a better solution, PLEASE post it here! Thanks a LOT!!
Lorie
function GetDefaultPrinter: string;
var
DefaultPrinter: array[0..79] of Char;
begin
GetProfileString('windows', 'device', '', DefaultPrinter,
SizeOf(DefaultPrinter) - 1);
Result := DefaultPrinter;
end;
procedure ChangeDefaultPrinter(const strIn: string);
var
i: integer;
begin
if strIn>'' then Begin
WriteProfileString('windows', 'device', PChar(strIn));
for i := 0 to 10 do
Application.ProcessMessages;
end;
end;