[英]How to change the active printer in MS word using delphi xe3
我使用以下代码打开MS Word文档:
try
{ Open the document}
WrdApp := CreateOLEObject('Word.Application');
wrdDoc := 'temp.docx');
// Wrddoc.SaveAs('temp2.docx');
except
on E: Exception do
begin
E.Message := 'Could Not Execute MS WORD!';
raise;
end;
end;
并使用wrdapp.Printout
打印
我有一个组合框,其中包含使用以下代码从计算机中获得的打印机名称的列表:
Combobox32.Items.Assign(Printer.Printers);
如何将MS Word中的活动打印机更改为组合框中的选定打印机,以便在我调用wrdapp.Printout
时从组合框中选择的打印机进行打印?
预先感谢您的帮助。
您可以简单地将WrdApp.ActivePrinter与要使用的打印机的名称关联起来。 在您的情况下,您可以从组合框中选择的项目中进行选择。 有关代码示例,请参见: http : //francois-piette.blogspot.be/2014/02/automate-word-document-print-using.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.