Applies to |
|---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Project type Microsoft Office version For more information, see Features Available by Application and Project Type. |
You can print an entire Microsoft Office Word document, or part of a document.
Printing a Document That Is Part of a Document-Level Customization
To print the entire document
To print the current page of the document
Printing a Document By Using an Application-Level Add-In
To print an entire document
To print the current page of a document
Call the PrintOut 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.
Me.Application.ActiveDocument.PrintOut( _
Background:=True, _
Append:=False, _
Range:=Word.WdPrintOutRange.wdPrintCurrentPage, _
Item:=Word.WdPrintOutItem.wdPrintDocumentContent, _
Copies:="1", _
Pages:="1", _
PageType:=Word.WdPrintOutPages.wdPrintAllPages, _
PrintToFile:=False, _
Collate:=True, _
ManualDuplexPrint:=False)
object copies = "1";
object pages = "1";
object range = Word.WdPrintOutRange.wdPrintCurrentPage;
object items = Word.WdPrintOutItem.wdPrintDocumentContent;
object pageType = Word.WdPrintOutPages.wdPrintAllPages;
object oTrue = true;
object oFalse = false;
Word.Document document = this.Application.ActiveDocument;
document.PrintOut(
ref oTrue, ref oFalse, ref range, ref missing, ref missing, ref missing,
ref items, ref copies, ref pages, ref pageType, ref oFalse, ref oTrue,
ref missing, ref oFalse, ref missing, ref missing, ref missing, ref missing);
Tasks
Concepts