これはとても単純な必要性のように思えますが、どういうわけか私はこれを達成する方法を見つけることができません。私はこのようなコードを持っています:
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
MemoryStream documentStream = getDocStream();
FileInfo wordFile = new FileInfo("c:\\test.docx");
object fileObject = wordFile.FullName;
object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document doc = wordInstance.Documents.Open(ref fileObject, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
doc.Activate();
doc.PrintOut(oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
使用するプリンターとトレイの設定ドライブが必要です。調べてみると、Microsoft.Office.Interop.Word.Application.ActivePrinterが見つかりました。これは、ドキュメントに「アクティブなプリンタの名前」と記載されている設定可能な文字列プロパティですが、プリンタにとってそれが何を意味するのかわかりません。 「アクティブプリンタ」、特に2つある場合。これはどのように達成できますか?