共用方式為


DocumentBase.PrintOut Method

Prints all or part of the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub PrintOut ( _
    ByRef background As Object, _
    ByRef append As Object, _
    ByRef range As Object, _
    ByRef outputFileName As Object, _
    ByRef from As Object, _
    ByRef to As Object, _
    ByRef item As Object, _
    ByRef copies As Object, _
    ByRef pages As Object, _
    ByRef pageType As Object, _
    ByRef printToFile As Object, _
    ByRef collate As Object, _
    ByRef activePrinterMacGX As Object, _
    ByRef manualDuplexPrint As Object, _
    ByRef printZoomColumn As Object, _
    ByRef printZoomRow As Object, _
    ByRef printZoomPaperWidth As Object, _
    ByRef printZoomPaperHeight As Object _
)
public void PrintOut(
    ref Object background,
    ref Object append,
    ref Object range,
    ref Object outputFileName,
    ref Object from,
    ref Object to,
    ref Object item,
    ref Object copies,
    ref Object pages,
    ref Object pageType,
    ref Object printToFile,
    ref Object collate,
    ref Object activePrinterMacGX,
    ref Object manualDuplexPrint,
    ref Object printZoomColumn,
    ref Object printZoomRow,
    ref Object printZoomPaperWidth,
    ref Object printZoomPaperHeight
)

Parameters

  • background
    Type: System.Object%

    true to have the customization code continue while Microsoft Office Word prints the document.

  • append
    Type: System.Object%

    true to append the document to the file specified by the OutputFileName argument; false to overwrite the contents of OutputFileName.

  • outputFileName
    Type: System.Object%

    If PrintToFile is true, this argument specifies the path and file name of the output file.

  • copies
    Type: System.Object%

    The number of copies to be printed.

  • pages
    Type: System.Object%

    The page numbers and page ranges to be printed, separated by commas. For example, "2, 6-10" prints page 2 and pages 6 through 10.

  • printToFile
    Type: System.Object%

    true to send printer instructions to a file. Make sure to specify a file name with OutputFileName.

  • collate
    Type: System.Object%

    When printing multiple copies of a document, true to print all pages of the document before printing the next copy.

  • activePrinterMacGX
    Type: System.Object%

    This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.

  • printZoomColumn
    Type: System.Object%

    The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.

  • printZoomRow
    Type: System.Object%

    The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.

  • printZoomPaperWidth
    Type: System.Object%

    The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

  • printZoomPaperHeight
    Type: System.Object%

    The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the PrintOut method to print two copies of the entire document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentPrintOut()

    Me.PrintOut(Background:=True, Range:=Word.WdPrintOutRange.wdPrintAllDocument, _
        Copies:=2, PageType:=Word.WdPrintOutPages.wdPrintAllPages, _
        PrintToFile:=False, Collate:=False, ManualDuplexPrint:=False, _
        PrintZoomColumn:=1, PrintZoomRow:=1)
End Sub
private void DocumentPrintOut()
{
    object Background = true;
    object Range = Word.WdPrintOutRange.wdPrintAllDocument;
    object Copies = 2;
    object PageType = Word.WdPrintOutPages.wdPrintAllPages;
    object PrintToFile = false;
    object Collate = false;
    object ActivePrinterMacGX = missing;
    object ManualDuplexPrint = false;
    object PrintZoomColumn = 1;
    object PrintZoomRow = 1;

    this.PrintOut(ref Background, ref missing, ref Range, ref missing,
        ref missing, ref missing, ref missing, ref Copies,
        ref missing, ref PageType, ref PrintToFile, ref Collate,
        ref missing, ref ManualDuplexPrint, ref PrintZoomColumn,
        ref PrintZoomRow, ref missing, ref missing);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace