Export one/multiple/all slides of a presentation in a graphic format.
#Include <PowerPoint.au3>
_PPT_PresentationExportGraphic($oPresentation[, $sPath = @ScriptDir[, $vSlides = Default[, $sFilter = "JPG"[, $iScaleWidth = Default[, $iScaleHeight = Default[, $bKeepRatio = True]]]]]])
Parameters
$oPresentation | Presentation object. |
$sPath | [optional] Directory where the graphics should be stored. The graphics are named Slide |
$vSlides | [optional] Slide(s) to process. Please see _PPT_SlideRangeSet for possible values (default = 0 = all Slides). |
$sFilter | [optional] The graphics format in which you want to export slides (default = JPG). See Remarks. |
$iScaleWidth | [optional] The width in pixels of an exported slide (default = keyword Default = do not change the width). |
$iScaleHeight | [optional] The height in pixels of an exported slide (default = keyword Default = do not change the heigth). |
$bKeepRatio | [optional] If set To True the width:height ratio is preserved if width or height is set (default = True) |
Return Value
Success: 1.
Remarks
The specified graphics format must have an export filter registered in the Windows registry.
Related
Example
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=N
#include <PowerPoint.au3>
#include <MsgBoxConstants.au3>
; **********************************************************
; Create application object and open an example presentation
; **********************************************************
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationExportGraphic Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationExportGraphic Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_PPT_Close($oPPT)
Exit
EndIf
; *************************************************************************************************
; Export slides 2 and 3 of the presentation as PNG, set new width and height but preserve the ratio
; *************************************************************************************************
_PPT_ErrorNotify(2)
Global $sTargetFolder = @ScriptDir & "\Presentation1"
_PPT_PresentationExportGraphic($oPresentation, $sTargetFolder, "2-3", "PNG", 267, 100, True)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationExportGraphic Example 1", "Error exporting '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationExportGraphic Example 1", "Presentation '" & $sPresentation & "' successfully exported to " & $sTargetFolder & ".")