ChartSheetBase.PrintOut 方法

列印 Microsoft.Office.Tools.Excel.ChartSheetBase

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public Sub 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 _
)
public void 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
    true 表示會讓 Microsoft Office Excel 在列印物件之前叫用預覽列印。false (或省略) 則表示會立即列印物件。
  • activePrinter
    型別:System.Object
    設定作用中印表機的名稱。
  • printToFile
    型別:System.Object
    true 表示列印至檔案。如果未指定 PrToFileName,則 Excel 會提示使用者輸入輸出檔的名稱。
  • collate
    型別:System.Object
    true 表示列印多份複本並自動分頁。
  • prToFileName
    型別:System.Object
    如果 PrintToFile 設定為 true,則這個引數會指定您想要列印至 (檔案) 的檔案名稱。

備註

在 From 和 To 的說明中,「頁」是指要列印的頁數,而不是工作表或活頁簿中的所有頁數。

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例會使用 PrintOut 方法,列印目前 Microsoft.Office.Tools.Excel.ChartSheetBase 的兩份複本。

Private Sub PrintChartSheet()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ChartType = Excel.XlChartType.xl3DColumn

    Me.PrintOut(Copies:=2, Preview:=True, PrintToFile:=False, _
        Collate:=False)
End Sub
private void PrintChartSheet()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ChartType = Excel.XlChartType.xl3DColumn;

    this.PrintOut(2, true, false, 
        false);
}

.NET Framework 安全性

請參閱

參考

ChartSheetBase 類別

Microsoft.Office.Tools.Excel 命名空間