Function Reference

_XLChart_PageSet

Set the page setup attributes (paper size, orientation, margins etc.) for a chart or chartsheet.

#Include <ExcelChart.au3>
_XLChart_PageSet($oChart[, $iPaperSize = Default[, $iOrientation = Default[, $iTopMargin = Default[, $iBottomMargin = Default[, $iLeftMargin = Default[, $iRightMargin = Default[, $iBlackAndWhite = Default]]]]]]])

 

Parameters

$oChart Chart object or chartsheet object for which the page setup properties should be set
$iPaperSize Optional: Sets the size of the paper. See enumeration XlPaperSize (default = Default)
$iOrientation Optional: Sets a XlPageOrientation value that represents the portrait or landscape printing mode (default = Default)
$iTopMargin Optional: Sets the top margin in centimeters (default = Default)
$iBottomMargin Optional: Sets the bottom margin in centimeters (default = Default)
$iLeftMargin Optional: Sets the left margin in centimeters (default = Default)
$iRightMargin Optional: Sets the right margin in centimeters (default = Default)
$bBlackAndWhite Optional: True if the chart will be printed in black and white (default = Default)

 

Return Value

Success: Returns 1
Failure: Returns 0 and sets @error:
    1 - $oChart is not an object
    2 - $iPaperSize is invalid. Must be an integer
    3 - $iOrientation is invalid. Must be an integer
    4 - $iTopMargin is invalid. Must be numeric
    5 - $iBottomMargin is invalid. Must be numeric
    6 - $iLeftMargin is invalid. Must be numeric
    7 - $iRightMargin is invalid. Must be numeric
    8 - $bBlackAndWhite is not boolean

 

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
; Setup page to A4, landscape
; Print chart 1 on the default printer with preview
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Setup page to A4, landscape, print chart 1 with preview ...")
Global $aResult = _XLChart_PageSet($aExcel[1], $xlPaperA4, $xllandscape, 2.5, 1.5, 2, 2)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_PageSet' on line " & @ScriptLineNumber)
$aResult = _XLChart_ChartPrint($aExcel[1], Default, 1, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_Print' on line " & @ScriptLineNumber)