Previous - pptSetAlignment Section Home - Microsoft PowerPoint Next - pptInsertMedia


pptInsertImg ( )

Inserts an image into the active slide

Usage:

pptInsertImg (object me, integer x, integer y, integer w, integer h, string filePath )

Parameters:

x (integer) - left position of the new image

y (integer) - top position of the new image

w (integer) - width of the new image

h (integer) - height of the new image

filePath (string) - the path to an existing image file to insert.

Returns:

(integer) - The success code

Example:

-- creates a new PowerPoint file based on the a screen capture of the stage
xtRose = xtra("Rosetta").new( )

-- take a screen capture of the stage off screen buffer
xtRose.imgFromScreen( 1 )

-- save the image to a temp folder
strTempFolder = xtRose.sysFolderTemp( )
strTempFilePath = xtRose.sysFileTemp( strTempFolder, "roseTmp" )
xtRose.imgSave(strTempFilePath)

-- ask user where they would like to save the PowerPoint file
strSavePath = xtRose.dlgFile( 1, the moviepath, "untitled.ppt", "Microsoft PowerPoint File (*.ppt)|*.ppt", "ppt")

-- create a new PowerPoint
nW = integer( xtRose.pptWidth( ) )
nH = integer( xtRose.pptHeight( ) )
xtRose.pptLaunch( )
xtRose.pptNewBlank( )
xtRose.pptAddSlide( 1 )
xtRose.pptInsertImg( 0, 0, nW, nH, strTempFilePath )
xtRose.pptSave( strSavePath )
xtRose.pptClose( )
xtRose.pptQuit( )

-- delete the temp image file
xtRose.sysFileDelete (strTempFilePath )

Notes:

PowerPoint may not be installed with all the image type decoders. It is recommended that images are imported in these formats: JPG, PNG, WMF, GIF, BMP. If an image have transparency, consider using PNG.

List


Previous - pptSetAlignment Section Home - Microsoft PowerPoint Next - pptInsertMedia