Adding a "Dynamic" Image to the Cover Page
All of the stock SI5 Proposal reports have a cover page. We have had requests from clients for the ability to have an image of their client’s house print on the cover page for each project. This method assumes that you are willing to pick a specific location and file name for the image file and that you will update this file for each project as this path and filename are going to be hardcoded into the report, i.e. – you will be using this same file name and path for every project.
Tip: once done running your reports for a project, to keep a copy of the image for each project by using the Add a File to This Project function.
- Create a folder somewhere on your machine. In this example the folder is on the C: drive and is named “_D-Tools CP Image”.
- Place whatever image you want to print on the cover page within this folder and give it a specific name. In this example, I will put a picture of the client’s house in the folder and name it CPImage.jpg.
- Open the Report Designer (Tools->Report Designer->Standard Reports) and choose to create a “New Report Based on Existing Report:
- Select the report where you want to base yours off of and click Next. In this example I am using the Proposal With Images report.
- Name your report on the next step then click Next through all the rest of the steps of this wizard until you get to the last step, then click Finish.
- On the canvas, drag a Picture control from the Toolbox over to the ReportHeader1 section (where the fields for the Cover Page are). Resize the box as desired.
- With the Picture control selected on the canvas, in the Properties window give the object a name and change the SizeMode field to “Zoom”:
- Click the Script tab along the bottom of the report designer:
- In the “ReportHeader1_Format” section, add the following line of code, substituting the name of your Picture control and path to your file.
ReportUtilities.SetImage(rpt,"ReportHeader1","picCP","C:\_D-Tools CP Image\CPImage.jpg")
- Click the Designer tab along the bottom of the report designer:
- Click the [Publish Report] button:
- Run your report and verify that your image displays on the cover sheet of the proposal:
- To test that this is dynamic, replace the image in the folder with another image, just make sure you name the file the same as above: