How to: Programmatically Print Documents

 

You can print an entire Microsoft Office Word document, or part of a document, to your default printer.

Applies to: The information in this topic applies to document-level projects and VSTO add-in projects for Word. For more information, see Features Available by Office Application and Project Type.

To print the entire document

  1. Call the PrintOut method of the ThisDocument class in your project to print the entire document. To use this example, run the code from the ThisDocument class.

    No code example is currently available or this language may not be supported.

To print the current page of the document

  1. Call the PrintOut method of the ThisDocument class in your project and specify that one copy of the current page be printed. To use this example, run the code from the ThisDocument class.

    No code example is currently available or this language may not be supported.

To print an entire document

  1. Call the M:Microsoft.Office.Interop.Word._Document.PrintOut(System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@) method of the Microsoft.Office.Interop.Word.Document object that you want to print. The following code example prints the active document. To use this example, run the code from the ThisAddIn class in your project.

    No code example is currently available or this language may not be supported.

To print the current page of a document

  1. Call the M:Microsoft.Office.Interop.Word._Document.PrintOut(System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@) method of the Microsoft.Office.Interop.Word.Document object that you want to print, and specify that one copy of the current page be printed. The following code example prints the active document. To use this example, run the code from the ThisAddIn class in your project.

    No code example is currently available or this language may not be supported.

Optional Parameters in Office Solutions

Show: