Page tree
Skip to end of metadata
Go to start of metadata


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.


This sample stores some of the data in a CSV file, which is available for download under *Downloads*. The CSV parser used in the example code was developed by Andrew Rissing and can be downloaded from Code Project.

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.

Our finished template will look like the following:

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.


The resulting slide is below:


* Data:data.csvchart.png
* Template:template.pptx
* Sample output: output.pptx


  • No labels