Mega Code Archive

 
Categories / Delphi / Examples
 

Quickreports printerindex out of range

The solution for PrinterSetting in Quickreport is unfortunate. The workarounds, discussed in newsgroups, didn't work with Windows NT. (PrinterIndex out of range: The Printer-Setup-Dialog seems to add Printernames with a connectionstring. Perhaps, there is a problem in Borlands Printers-Unit or in a corner of the Microsoft-jungle too). This is a simple solution: Add Unit Printers to your Form that controls Printing. Add an TCombobox and name it 'cbxPrinters' In FormCreate add the following statement: cbxPrinters.Items.Assign(Printer.Printers); The User has to choose the desired Printer with this Combobox. Insert before the print-statement the following statement ('qrp' is the name of the TQuickRep-Object) qrp.PrinterSettings.PrinterIndex:=cbxPrinters.ItemIndex; REMARK: the quickreport-preview-printersetupdialog will not be affected. Test it and instruct your users.