Set the Text of a Shape or Shapes of a single or multiple Slides.
#Include <PowerPoint.au3>
_PPT_TextSet($oPresentation, $sText[, $vSlides = 0[, $vShapes = 0]])
Parameters
$oPresentation | Object of the presentation to process. |
$sText | Text to insert into the Shapes. |
$vSlides | [optional] Slides to process. See Remarks (default = 0 = all Slides). |
$vShapes | [optional] Shapes to process on each selected Slide. See Remarks (default = 0 = all Shapes). |
$iFlag | [optional] This flag specifies how to process the Text: 0 - Replace the existing Text in the Shape (default). 1 - Prepend the Text to the existing Text in the Shape. 2 - Append the Text to the existing Text in the Shape. |
Return Value
Success: 1, @extended holds the number of processed Shapes.
Remarks
With this function you can set the text of a single Shape of multiple Slides or multiple Shapes of a single Slide.
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 a presentation
; *************************************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_TextSet Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Open presentation
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_TextSet Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_PPT_Close($oPPT)
Exit
EndIf
; ***********************************************************************************************
; Prepend Text to the existing Text of Shape 1 on Slides 1 and 2
; ***********************************************************************************************
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_TextSet Example 1", "Presentation before Text is Set!", 5)
_PPT_TextSet($oPresentation, "TestText: " & @CRLF, "1-2", 1, 1)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_TextSet Example 1", "Error setting Text." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_TextSet Example 1", @extended & " Shapes modified in the specified range!")