怎么在打印前控制QKReport的打印设置,请高手剔教!不胜感谢!!!!(100分)

  • 主题发起人 主题发起人 fjw
  • 开始时间 开始时间
F

fjw

Unregistered / Unconfirmed
GUEST, unregistred user!
我用QKReport做了一个打印农业税通知书的报表,它的打印纸张为自定义,方向为
纵向,当用户在打印前需要在WINDOWS的打印机设置里把WINDOWS的打印纸张和方向
设置正确,否则就不能正常打印,这很不方便,请问有没有方法在打印前由程序自
动设置WINDOWS的打印机设置啊。谢谢高手指点,衷心祝你万事如意!!!
 
我这里给出设置纸张和方向的方法。
Function MainPrintSet(MainQuickrep: TQuickrep): Boolean;
Var
Device, Driver, Port : array[0..255] of char;
ADevMode : THandle;
DevMode : PDeviceMode;
begin

Try
Result := True;
MainQuickrep.Units := Pixels;
If GetPrintIndex<>Printer.PrinterIndex then

DefaultPrinterFlag:=True;
MainQuickrep.PrinterSettings.PrinterIndex := printer.PrinterIndex;
MainQuickrep.Page.Orientation := printer.Orientation;//方向
with Printerdo

GetPrinter(Device, Driver, Port, ADevMode);
if ADevMode<>0 then

begin

DevMode := GlobalLock(ADevMode);
Case DevMode^.dmPaperSize of//纸张
DMPAPER_LETTER: MainQuickrep.Page.PaperSize := Letter;
DMPAPER_LETTERSMALL: MainQuickrep.Page.PaperSize :=
LetterSmall;
DMPAPER_TABLOID: MainQuickrep.Page.PaperSize := Tabloid;
DMPAPER_lEDGER: MainQuickrep.Page.PaperSize := Ledger;
DMPAPER_lEGAL: MainQuickrep.Page.PaperSize := Legal;
DMPAPER_STATEMENT: MainQuickrep.Page.PaperSize := Statement;
DMPAPER_EXECUTIVE: MainQuickrep.Page.PaperSize := Executive;
DMPAPER_A3: MainQuickrep.Page.PaperSize := A3;
DMPAPER_A4: MainQuickrep.Page.PaperSize := A4;
DMPAPER_A4SMALL: MainQuickrep.Page.PaperSize := A4Small;
DMPAPER_A5: MainQuickrep.Page.PaperSize := A5;
DMPAPER_B4: MainQuickrep.Page.PaperSize := B4;
DMPAPER_B5: MainQuickrep.Page.PaperSize := B5;
DMPAPER_FOLIO: MainQuickrep.Page.PaperSize := Folio;
DMPAPER_QUARTO: MainQuickrep.Page.PaperSize := Quarto;
DMPAPER_10X14: MainQuickrep.Page.PaperSize := qr10X14;
DMPAPER_11X17: MainQuickrep.Page.PaperSize := qr11X17;
DMPAPER_NOTE: MainQuickrep.Page.PaperSize := Note;
DMPAPER_ENV_9: MainQuickrep.Page.PaperSize := Env9;
DMPAPER_ENV_10: MainQuickrep.Page.PaperSize := Env10;
DMPAPER_ENV_11: MainQuickrep.Page.PaperSize := Env11;
DMPAPER_ENV_12: MainQuickrep.Page.PaperSize := Env12;
DMPAPER_ENV_14: MainQuickrep.Page.PaperSize := Env14;
else

begin

GlobalUnlock(ADevMode);
Result:=false;
Exit;
end;

end;

GlobalUnlock(ADevMode);
end;

Except
Result:=false;
GlobalUnlock(ADevMode);
Exit;
end;

end;
 
可以直接调用那个控件的setup方法吧
 

Similar threads

后退
顶部