我用了你说的方法,还用了以下方法:
procedure printWebReport(wb: TWebBrowser);
var
ADevice,ADriver,APort: array[0..255] of Char;
DeviceHandle: THandle;
DevMode: PDeviceMode;
begin
if wb = nil then
exit;
Printer.GetPrinter(ADevice,ADriver,APort,DeviceHandle);
if DeviceHandle = 0 then
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(ADevice,ADriver,APort,DeviceHandle);
end;
if DeviceHandle = 0 then
Raise Exception.Create('Could not initialize')
else
DevMode := GlobalLock(DeviceHandle);
if not DeviceHandle = 0 then
GlobalUnlock(DeviceHandle);
with DevMode^do
begin
dmFields := dmFields or DM_ORIENTATION;
dmOrientation := DMORIENT_PORTRAIT;
end;
wb.ExecWB(OLECMDID_PRINT, 2);
end;
都没有效果,哪位大侠能帮帮我?