title | description | ms.date | ms.topic | dev_langs | helpviewer_keywords | author | ms.author | manager | ms.subservice | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Programmatically print documents |
Learn how you can print an entire Microsoft Word document, or part of a document, to your default printer. |
02/02/2017 |
how-to |
|
|
John-Hart |
johnhart |
mijacobs |
office-development |
You can print an entire Microsoft Office Word document, or part of a document, to your default printer.
[!INCLUDEappliesto_wdalldocapp]
-
Call the xref:Microsoft.Office.Tools.Word.Document.PrintOut%2A method of the
ThisDocument
class in your project to print the entire document. To use this example, run the code from theThisDocument
class.:::code language="csharp" source="../vsto/codesnippet/CSharp/Trin_VstcoreWordAutomationCS/ThisDocument.cs" id="Snippet11":::
-
Call the xref:Microsoft.Office.Tools.Word.Document.PrintOut%2A 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 theThisDocument
class.:::code language="csharp" source="../vsto/codesnippet/CSharp/Trin_VstcoreWordAutomationCS/ThisDocument.cs" id="Snippet12":::
-
Call the xref:Microsoft.Office.Interop.Word._Document.PrintOut%2A method of the xref: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.:::code language="csharp" source="../vsto/codesnippet/CSharp/Trin_VstcoreWordAutomationAddIn/ThisAddIn.cs" id="Snippet11":::
-
Call the xref:Microsoft.Office.Interop.Word._Document.PrintOut%2A method of the xref: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.:::code language="csharp" source="../vsto/codesnippet/CSharp/Trin_VstcoreWordAutomationAddIn/ThisAddIn.cs" id="Snippet12":::