[英]Office.Interop.Word - How to print the document on both sides?
I print documents (batch print) using Word.Document.PrintOut
method. 我使用Word.Document.PrintOut
方法打印文档(批量打印)。 How can I print a document on both sides? 如何在两面打印文档?
In the MS Word interface it can be done through the File -> Print -> Print on Both Sides option. 在MS Word界面中,可以通过文件 - > 打印 - > 双面打印选项来完成。
Word 2010, C#, .NET 3.5 Word 2010,C#,.NET 3.5
Many thanks to John for his answer (+1)! 非常感谢John的回答(+1)! There are results of my research: 有我的研究结果:
After the failure of the DocumentProperties API I tried to put the print commands and got the following results: 在DocumentProperties API失败后,我尝试放置打印命令并得到以下结果:
So my investigation continues and if anyone have other ideas - welcome! 所以我的调查仍在继续,如果有人有其他想法 - 欢迎!
There is a Microsoft KB Article on HOWTO: Set Duplex Printing for Word Automation , unfortunately it is not a simple property you set. 有关HOWTO的Microsoft知识库文章:为Word Automation设置双面打印 ,遗憾的是它不是您设置的简单属性。 It is VB code, but it should be pretty easy to convert to C#. 它是VB代码,但转换为C#应该很容易。
If you know you are using a PCL compatible printer, you can use print commands inside the document to force it to be duplex. 如果您知道使用的是PCL兼容打印机,则可以在文档中使用打印命令强制它为双面打印机。 This is really helpful when you need to switch between simplex and duplex mid document. 当您需要在单面和双面中间文档之间切换时,这非常有用。 You can add a field to the header of the document and then use 27"&l1S" or 27"&l2S" for duplex long and duplex short respectively. 您可以在文档的标题中添加一个字段,然后分别使用27“&l1S”或27“&l2S”表示双工长和双工短路。 A full list of PCL print commands are available from a Microsoft KB article. Microsoft知识库文章中提供了完整的PCL打印命令列表。
The problem can not been solved directly, but it is possible to implement a workaround. 问题无法直接解决,但可以实施解决方法。
One "physical" printer should be installed on the client system several times, so that in the printers list it should be listed twice under different names. 应在客户端系统上多次安装一台“物理”打印机,以便在打印机列表中以不同的名称列出两次。
Further, one of these "printers" must be configured to double side printing, and second to normal - one side printing. 此外,这些“打印机”中的一个必须配置为双面打印,其次是正常打印 - 单面打印。 Depending on the application needs it selects one of two "printers" for printing documents. 根据应用程序的需要,它选择两个“打印机”之一来打印文档。
在ManualDuplexPrint参数设置为true的情况下,调用Microsoft.Office.Interop.Word.Document对象的PrintOut()方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.