打印 XmlMappedRange 控件。
命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)
语法
声明
Function PrintOut ( _
    From As Object, _
    To As Object, _
    Copies As Object, _
    Preview As Object, _
    ActivePrinter As Object, _
    PrintToFile As Object, _
    Collate As Object, _
    PrToFileName As Object _
) As Object
Object PrintOut(
    Object From,
    Object To,
    Object Copies,
    Object Preview,
    Object ActivePrinter,
    Object PrintToFile,
    Object Collate,
    Object PrToFileName
)
参数
- From
 类型:System.Object
 要打印的第一页的页码。如果省略此参数,则打印从第一页开始。
- To
 类型:System.Object
 要打印的最后一页的页码。如果省略此参数,则打印完最后一页后停止打印。
- Copies
 类型:System.Object
 要打印的份数。如果省略此参数,则打印一份副本。
- Preview
 类型:System.Object
 如果让 Microsoft Office Excel 在打印对象之前调用打印预览,则为 true;如果立即打印对象,则为 false(或者省略)。
- ActivePrinter
 类型:System.Object
 设置活动打印机的名称。
- PrintToFile
 类型:System.Object
 为 true 时打印到文件。如果未指定 PrToFileName,则 Excel 将提示用户输入输出文件的名称。
- Collate
 类型:System.Object
 如果为 true,则逐份打印多个副本。
- PrToFileName
 类型:System.Object
 如果 PrintToFile 设置为 true,则此参数指定要打印到的文件的名称。
返回值
备注
From 和 To 的说明中的“页”指打印页 -- 而不是工作表或工作簿中的所有页。
可选参数
有关可选参数的信息,请参见Office 解决方案中的可选参数。
示例
下面的代码示例使用 PrintOut 方法将 XmlMappedRange 打印到文件。 此代码示例假定当前工作表包含一个名为 CustomerLastNameCell 的 XmlMappedRange。
Private Sub PrintToFile()
    Me.CustomerLastNameCell.Value2 = "Smith"
    Me.CustomerLastNameCell.PrintOut(Copies:=1, Preview:=True, PrintToFile:=True)
End Sub
private void PrintToFile()
{
    this.CustomerLastNameCell.Value2 = "Smith";
    this.CustomerLastNameCell.PrintOut(missing, missing, 1, true, missing,
        true, missing, missing);
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。