Description
This sample demonstrates how to use PowerPointWriter's Image modifier to add images to your presentation. This sample covers importing images with specific dimensions, and using the PowerPointApplication object to align images on a slide.
The Data
The data for this sample consists of data regarding sales of certain products and an image showing the data on a chart.
!data.png!
The Template
Our template presentation consists of a single slide with three data markers. Two of the data marker are placed in a table and will expand to fit the sales data. The third data marker, %%=Images.Chart(image(2)), is for our chart image. This data marker uses the image modifier with the scaling value 2. See [Importing Images] for more on scaling values. In this case, the imported image will be scaled to fit within the text box containing the data marker, but will retain its natural aspect ratio.
By default, text boxes will automatically take on the dimensions of the text inside of them. However, we want to set the text box to be the desired size for the imported picture. To allow re-sizing of the text box, use the _Do not Autofit_ option. To set _Do not Autofit_, right click on the text box and click Size and Position. On the text box tab, check the box marked Do not Autofit.
!DoNotAutofit.png!
Our finished template will look like the following:
!template.png!
The Code
The code below uses PowerPointTemplate to import the images into the presentation. It then uses PowerPointApplication to align the chart on our slide.
Result
The resulting slide is below:
!output.png!
Downloads
* Data:[Chart Image Report^data.csv], [Chart Image Report^chart.png]
* Template:[Chart Image Report^template.pptx]
* Sample output: [Chart Image Report^output.pptx]