Document.PrintOut 方法 (2007 system)

更新:2007 年 11 月

打印文档的一部分或全部。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word.v9.0(在 Microsoft.Office.Tools.Word.v9.0.dll 中)

语法

声明
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 _
)
用法
Dim instance As Document
Dim Background As Object
Dim Append As Object
Dim Range As Object
Dim OutputFileName As Object
Dim From As Object
Dim To As Object
Dim Item As Object
Dim Copies As Object
Dim Pages As Object
Dim PageType As Object
Dim PrintToFile As Object
Dim Collate As Object
Dim ActivePrinterMacGX As Object
Dim ManualDuplexPrint As Object
Dim PrintZoomColumn As Object
Dim PrintZoomRow As Object
Dim PrintZoomPaperWidth As Object
Dim PrintZoomPaperHeight As Object

instance.PrintOut(Background, Append, _
    Range, OutputFileName, From, To, Item, _
    Copies, Pages, PageType, PrintToFile, _
    Collate, ActivePrinterMacGX, ManualDuplexPrint, _
    PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, _
    PrintZoomPaperHeight)
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
)

参数

  • Background
    类型:System.Object%

    如果为 true,则可以让自定义代码在 Microsoft Office Word 打印文档时继续工作。

  • Append
    类型:System.Object%

    如果为 true,则会将文档追加到 OutputFileName 参数指定的文件;如果为 false,则会覆盖 OutputFileName 的内容。

  • OutputFileName
    类型:System.Object%

    如果 PrintToFile 为 true,则此参数指定输出文件的路径和文件名。

  • Pages
    类型:System.Object%

    要打印的页码和页码范围,由逗号分隔。例如,“2, 6-10”意为打印第 2 页和第 6 至 10 页。

  • PrintToFile
    类型:System.Object%

    如果为 true,则将打印机指令发送到文件。请确保使用 OutputFileName 指定一个文件名。

  • Collate
    类型:System.Object%

    在打印多份文档时,如果为 true,则先打印该文档的所有页,然后再打印下一份。

  • ActivePrinterMacGX
    类型:System.Object%

    此参数仅在 Microsoft Office Macintosh Edition 中可用。有关此参数的其他信息,请查询 Microsoft Office Macintosh Edition 附带的语言参考帮助。

  • PrintZoomColumn
    类型:System.Object%

    希望 Word 在一页上水平布置的页数。可以为 1、2、3 或 4。与 PrintZoomRow 参数一起使用时可在单张纸上打印多页。

  • PrintZoomRow
    类型:System.Object%

    希望 Word 在一页上垂直布置的页数。可以为 1、2 或 4。与 PrintZoomColumn 参数一起使用时可在单张纸上打印多页。

  • PrintZoomPaperWidth
    类型:System.Object%

    希望 Word 将打印页缩放到的宽度(以缇表示,20 缇 = 1 磅,72 磅 = 1 英寸)。

  • PrintZoomPaperHeight
    类型:System.Object%

    希望 Word 将打印页缩放到的高度(以缇表示,20 缇 = 1 磅,72 磅 = 1 英寸)。

备注

可选参数

有关可选参数的信息,请参见了解 Office 解决方案中的可选参数

示例

下面的代码示例使用 PrintOut 方法将整个文档打印两份。

此示例针对的是文档级自定义项。

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);
}

权限

另请参见

参考

Document 类

Document 成员

Microsoft.Office.Tools.Word 命名空间