Desktop User Guides > Professional > Table scripting > Table presentation > Displaying images for elements
Displaying images for elements
Sample script file: DisplayElementImages.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for more information.
In UNICOM Intelligence Reporter version 2.2 and later, you can attach images to the rows or columns in a table using the Image and ImagePosition properties of the Style object. It is not possible to add images directly in UNICOM Intelligence Reporter - Survey Tabulation, but images that have been attached using UNICOM Intelligence Interviewer - Server Admin or UNICOM Intelligence Reporter are automatically displayed in UNICOM Intelligence Reporter - Survey Tabulation.
You can include the images when you export tables to HTML, using either a script or the Export dialog in UNICOM Intelligence Reporter - Survey Tabulation. From UNICOM Intelligence Reporter version 2.3 and later, you can also include the images when you export to Word.
To specify a single location where the script should look for all the images, you can use the ImageLocation property of the Document object, for example:
TableDoc.ImageLocation = "[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\Tables\Images"
If you use this property to specify a path, all images must be in the specified location. You can specify a local path, a UNC path (\\server\folder\...), an HTTP server location (http://server/folder/...), or an HTTP image cache location (for example, http://server/folder/ImageCache/ImageCache.aspx?project=Museum&file=). If the images are in the directory where the exported document is saved, there is no need to specify a path.
To attach the image to the element, use the Style property of the Element object. The Style object has two properties, Image and ImagePosition. Use the Image property to specify the name of the image:
Table.Side.Interest.Elements.Dinosaurs.Style.Image = "Dinosaur.gif"
If you have not specified a path for all the images using the ImageLocation property, you can specify paths for individual images using the Image property, for example:
Table.Side.Interest.Elements.Dinosaurs.Style.Image = "C:\Documents and Settings\All Users\Documents\My Pictures\Dinosaur.gif"
If you have specified the ImageLocation property, you can override it using the Image property, provided that you are using an HTTP path, as the ImageLocation property is not added to the image in this case. Note that you cannot override an ImageLocation property using a local or UNC path in the Image property, as the path does not replace the existing path but is appended to it.
Use the ImagePosition property to position the image in the cell relative to the label text, or to replace the label with the image:
Table.Side.Interest.Elements[..].Style.ImagePosition = 4 ' 4 = ipImageOnly
If images have been attached to elements in the metadata using the Picture and PicturePosition custom properties, the Image and ImagePosition properties default to these values.
To include the images when you export a table to HTML or Word, set the UseStyles export property to True. For further information, see HTML tables export properties and Microsoft Word tables export properties.
Here is an example using Microsoft clipart images:
This graphic is described in the surrounding text.
Style properties are ignored when you create a chart, and the labels are displayed instead.
See also
Table presentation