[英]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.