Using the Image Modifier
The image modifier can be used to insert images into a data marker. To insert an image into a data marker using the image modifier:
Create or open a PowerPointTemplate
Add the image modifier in to the data marker in which you want to insert the image. For example, change %%=Company.Logo to %%=Company.Logo(image)
If desired, set the image modifier's dimensions and sizing mode.
Setting the Image Size
There are three ways to set the size of the imported image.
Import the image with its original dimensions
If the image modifier is used without arguments the image will maintain its original dimensions.
Size the image to match the text box containing the data marker.
If the image modifier is used with a scaling [mode|#modes] as its only parameter, the image will be scaled accordingly and sized to fit the containing text box.
Specify the dimensions as parameters in the image modifier.
The image modifier can take parameters specifying the image dimensions. Dimensions can also be used with a scaling [mode|#modes]. Dimensions are in inches.
The syntax for specifying an images dimensions without the scaling mode is image(width, height).
To use a scaling mode, add it as the third parameter in your modifier.
The scaling mode can have the following values:
The image will always be the width and height specified regardless of its natural size.
The image will always be enlarged or shrunk to fit within the bounds specified by width and height but it will keep its natural aspect ratio.
The image will be scaled down to within the bounds specified by width and height but it will keep its natural aspect ratio.
Writing the Code
If you are using a database as a data source, the column that corresponds to the data marker containing the image must be of the type BLOB("Image" in SQL Server).
If the data source is an array of objects, the value that corresponds to the data marker containing the image should be a simple byte array.
Aligning the Image
Note: This feature requires PowerPointApplication
To programmatically set the alignment of the picture on the slide, use the [Picture.Align|Picture.Align(Alignment)] method. Picture.Align takes an [Alignment] object as a parameter. The Alignment object can have the following values:
Aligns the picture at the top of the slide.
Aligns the picture in the middle of the slide.
Aligns the picture on the bottom of the slide.
Aligns the picture on the left side of the slide.
Aligns the picture in the center of the slide.
Aligns the picture on the right side of the slide.
The code below demonstrates importing the image from an array and setting the alignment of the image.