首页 > 解决方案 > 如何在 C# 中双面打印 Word.Document?

问题描述

快速总结

我可以使用PrintOut()如下函数在 C# 中打印出 Wo​​rd 文档:

        object missing = Type.Missing;
        Word.Application app = new Word.Application();
        Word.Document doc = null;
        object template = @"/path/Template.docx";
        doc = app.Documents.Open(template, ReadOnly: true);
        app.Visible = false;

        // Print here
        doc.PrintOut();

问题

我意识到如果有 2 页,我无法在两页上打印文档。2 页打印 2 张,而不是双面打印。

我在这里看了一下:https ://docs.microsoft.com/en-us/office/vba/api/Word.Document.PrintOut没有任何关于双面打印的信息。

问题

Word.Document在纸的两面用 C#打印 a 的好方法是什么?

标签: c#

解决方案


它应该是您可以在物理打印机中更改的设置,如果这不起作用尝试调用 Microsoft.Office.Interop.Word.Document 对象的 PrintOut() 方法,并将 ManualDuplexPrint 参数设置为 true。


推荐阅读