[.NET C# - Word] 列印 Word

摘要:[.NET C# - Word] 列印 Word

 

01 using Microsoft.Office.Interop.Word;  
02   
03 public class WordHelper  
04 {  
05     private _Document m_Document = null;  
06     private _Application m_wordApplication = null;  
07   
08     /// <summary>
09     /// Word列印的方法
10     /// </summary>

11     private void PrintOut()
12     {
13         object oBackground = false;
14         object oRange = WdPrintOutRange.wdPrintAllDocument;
15         object oOutputFileName = oMissing;
16         object oItems = WdPrintOutItem.wdPrintDocumentContent;
17         object oCopies = 1;
18         object oPages = "";
19         object oPageType = WdPrintOutPages.wdPrintAllPages;
20         object oPrintToFile = false;
21         object oCollate = true;
22         object oManualDuplexPrint = false;
23         object oPrintZoomColumn = 0;
24         object oPrintZoomRow = 0;
25         object oPrintZoomPaperWidth = 0;
26         object oPrintZoomPaperHeight = 0;
27         object oTrue = true;
28         object oFalse = false;
29
30         this.m_Document.PrintOut(ref oBackground, ref oFalse, ref oRange, ref oOutputFileName, ref oMissing, ref oMissing, ref oItems, ref oCopies, ref oPages, ref oPageType, ref oPrintToFile, ref oCollate, ref oMissing, ref oManualDuplexPrint, ref oPrintZoomColumn, ref oPrintZoomRow, ref oPrintZoomPaperWidth, ref oPrintZoomPaperHeight);
31         this.m_wordApplication.WindowState = WdWindowState.wdWindowStateNormal;
32     }

33 }