Set properties of a shadow.
#Include <ExcelChart.au3>
_XLChart_ShadowSet($oObject[, $iForeColor = Default[, $bThemeColor = False[, $iOffsetX = Default[, $iOffsetY = Default[, $iTransparency = Default[, $iVisible = $xlSheetVisible]]]]]])
Parameters
$oObject | Object to apply the shadow properties to (e.g. $oChart or $oChart.Axes($xlCategory)) |
$iForeColor | Optional: Sets the foreground fill color (default = Default) You can set colors to an explicit red-green-blue value (e.g. 0xFF00FF) or to a color in the color scheme (negative numbers -1 to -56) |
$bThemeColor | Optional: True specifies that $iForeColor is interpreted as theme color (default = False). If set to True the $iForeColor value has to be one of the MsoThemeColorIndex enumeration |
$iStyle | Optional: Shadow style. Can be any of the MsoShadowStyle enumeration (default = Default) |
$iBlur | Optional: sets the degree of blurriness of the specified shadow (default = Default) |
$iOffsetX | Optional: The horizontal offset of the shadow from the specified shape, in points (default = Default). A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left |
$iOffsetY | Optional: The vertical offset of the shadow from the specified shape, in points (default = Default). A positive value offsets the shadow to the top of the shape; a negative value offsets it to the bottom |
$iTransparency | Optional: The degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear) (default = Default) |
$iVisible | Optional: Determines whether the shadow is visible. Please check the XlSheetVisibility enumeration. Can be $xlSheetHidden or $xlSheetVisible (default = $xlSheetVisible) |
Return Value
Success: Returns 1
Remarks
Excel 2007: Just draws a shadow on the border. So you have to make sure the object (chart title, legend etc.) has a border drawn. Else you won't see a shadow.
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>
; Different behaviour of Excel 2007 vs Excel 2010 !!!
; Shadow of text components (like ChartTitle, Legend, etc) don't exist in 2007
$iXLC_Debug = 0
; *****************************************************************************
; Create example environment
; *****************************************************************************
Global $aExcel = _XLChart_Example(True, 0, 0, -1, -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)
Global $ixlVersion = _XLChart_Version($aExcel[0])
; *****************************************************************************
; Example 1
; Change shadow of the chart area
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Shadow of the chart area")
_XLChart_ShadowSet($aExcel[2].ChartArea, 0xFF0000, False, $msoShadowStyleOuterShadow, 10, 5, 5)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ShadowSet' on line " & @ScriptLineNumber)
; *****************************************************************************
; Example 2
; Change shadow of the chart title
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Shadow of the chart title")
If $ixlVersion = 12 Then $aExcel[1].ChartTitle.Format.Line.Visible = 1 ; In Excel 2007 we have to make the shadow visible by first setting the border
_XLChart_ShadowSet($aExcel[1].ChartTitle, $msoThemeColorAccent6, True, $msoShadowStyleOuterShadow, 5, 5, 5)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ShadowSet' on line " & @ScriptLineNumber)
; *****************************************************************************
; Example 3A
; Change shadow of the Legend
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Shadow of the legend")
If $ixlVersion = 12 Then $aExcel[2].Legend.Format.Line.Visible = 1 ; In Excel 2007 we have to make the shadow visible by first setting the border
_XLChart_ShadowSet($aExcel[2].Legend, 0xFF0000, False, Default, Default, 5, 5)
; *****************************************************************************
; Example 3B
; Change shadow of the Legend
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Shadow of the legend - now with style and blur")
_XLChart_ShadowSet($aExcel[2].Legend, 0xFF0000, False, $msoShadowStyleOuterShadow, 5, 5, 5)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ShadowSet' on line " & @ScriptLineNumber)
; *****************************************************************************
; Example 4
; Set Green inner shadow on the plot area
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Inner shadow of the plot area")
_XLChart_ShadowSet($aExcel[1].Plotarea, 0x00FF00, False, $msoShadowStyleInnerShadow, 10, -5, 5, 0.5)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_ShadowSet' on line " & @ScriptLineNumber)