Function Reference

_XLChart_ChartPrint

Print a chart or a chartsheet.

#Include <ExcelChart.au3>
_XLChart_ChartPrint($oChart[, $sActivePrinter = Default[, $iCopies = 1[, $bPreview = False[, $bPrintToFile = False[, $sPrintToFileName = Default]]]]])

 

Parameters

$oChart Object to be printed. Can be a chart or a chartsheet.
$sActivePrinter Optional: Name of the printer to be used. Defaults to active printer (default = Default)
$iCopies Optional: Number of copies to print (default = 1)
$bPreview Optional: If True a print preview is displayed (default = False)
$bPrintToFile Optional: If True the output is written to a file (default = False)
$sPrintToFileName Optional: If $bPrintToFile is True, this argument specifies the name of the file you want to print to (default = Default)

 

Return Value

Success: Returns 1
Failure: Returns 0 and sets @error:
    1 - $oChart is not of type object
    2 - $iCopies is not numeric or < 1
    3 - $bPreview is not boolean
    4 - $bPrintToFile is not boolean
    5 - Error printing the specified object. See @extended for details (error returned by method PrintOut)

 

Remarks

None.

 

Related

 

Example


#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include-once
#include <ExcelChart.au3>

; *****************************************************************************
; Create example environment
; *****************************************************************************
Global $aExcel = _XLChart_Example(True, 0, 3, 6, -1)
If @error = 2  Then Exit MsgBox(16, "Excel Chart Example Script", "The installed Excel version is not supported by this UDF!" & @CRLF & "Version must be >= 12 (Excel 2007).")
If @error <> 0 Then Exit MsgBox(16, "Excel Chart Example Script", "Error " & @error & " returned by _XLChart_Example on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 1
; Print chart 1 on the default printer with preview activated
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now printing chart 1 on the default printer with preview ...")
Global $aResult = _XLChart_ChartPrint($aExcel[1], Default, 1, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ChartPrint' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 2
; Print the chart sheet on the default printer
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now printing the chart sheet on the default printer ...")
$aResult = _XLChart_ChartPrint($aExcel[3])
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ChartPrint' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 3
; Print chart 2 to a file, ask user for filename
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now printing chart 2 to a file ...")
$aResult = _XLChart_ChartPrint($aExcel[2], Default, 1, False, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ChartPrint' on line " & @ScriptLineNumber)