Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

How to print a Word.Document on both sides in C#?

Quick summary

I am able to print out a Word document in C# using PrintOut() function like so:

        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();

Problem

What I realized is I can't print the document on both pages, if there are 2 pages. The 2 pages print 2 sheets, instead of printing on both sides.

I had a look here: https://docs.microsoft.com/en-us/office/vba/api/Word.Document.PrintOut nowhere it says anything about Printing on Both sides.

Question

What is a good method to print a Word.Document in C# on both sides of paper?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It should be a setting you can change in the physical printer if that doesn't work try calling the PrintOut() method of Microsoft.Office.Interop.Word.Document object with ManualDuplexPrint parameter set to true.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...