Image Report Item


Image report item, as the name implies, is designed to display an image. SSRS supports .bmp, .jpg, .jpe, .gif , and .png image formats. An image can be embedded in a report, stored as a part of the project, stored in a database, or loaded from a URL.

You can add an image to a report in several ways. The most common is to drag an Image report item from the Toolbox and drop it onto a report (or generally on any container item). Report Designer displays the Image Wizard with the window shown in Figure 11.2. To see the window, click the Next button on the Welcome screen at the drop completion.

Figure 11.2. Selecting the Image Source window.


The Image Source window, as the name implies, allows you to select the source of the image. If you select Embedded or Project, Report Designer shows a window similar to Figure 11.3.

Figure 11.3. Choosing the image from the project.


Report Designer assigns the name logo to an image with the filename logo.jpg . You can change the name, if you want, just make sure to click on a cell different from the one that contains the name of the image to commit the change.

Understanding the underlying difference between embedded and project images will help you to understand differences in the handling of those images. An embedded image is actually a MIME-encoded image, stored as text in the report definition file.

An embedded image is stored in the RDL file and rendered during the render process.

A project image is a file that first gets added as an item to a project (and copied as a file to the project's directory from an original location) and then gets published as a resource file to a Report Server.

Note

In addition to using the Image Wizard described previously, you can add a project image by dragging and dropping a graphical file on the project in Solution Explorer or by adding an image from the Add Existing Item menu. You can access the Add Existing Item menu from the Project menu or from the drop-down Add menu in Solution Explorer.


Both embedded and project image selection dialog boxes allow adding several images with the same name.

For example, for images from the file logo.jpg , Report Designer adds images logo, logo_1, and so on. Report Designer does not compare encoded images in a report to determine if there is a duplication, thus Report Designer adds more embedded images with the same content, automatically incrementing the name.

The Project image selection dialog box behaves similarly until you save changes. When saving changes, Report Designer eliminates duplicates and adds only a single file logo.jpg to a project.

Technically, there is no reason to keep duplicates whether the image is embedded or project-level. Because the project-level image is saved as a file, there could be only one file with the specific name.

Note

As you are using the Image Wizard (starts when you drag and drop an Image control on a report), please note image's Source and Value properties.

You can modify Source and Value properties to change the source of an image.


The Delete button in the Image Selection dialog box of the Image Wizard is disabled for the existing embedded or project-level images. The Delete button is available only for new (added during the wizard's session) images before the addition is finalized.

You can delete or rename project-level images through Solution Explorer.

You can add, delete, or rename embedded images through the Embedded Images dialog box, which can be accessed through the Report, Embedded Images menu. Alternatively, you can edit an RDL file of a report to delete or rename embedded images.

Embedded images insert character-encoded information in the RDL file. {MIME} indicates graphical format of the image, for example image/jpg .

 <EmbeddedImages>     <EmbeddedImage Name="logo">       <ImageData>{Character encoded binary Data}</ImageData>        <MIMEType>{MIME}</MIMEType>      </EmbeddedImage> </EmbeddedImages> 

The RDL for an Image can be broken down into the sections shown in Table 11.2.

Table 11.2. Image's RDL Explained

Element

Explanation

 <Image Name="image1">   {POSITION} 

Open tag and image's position on a report.

 <Source>{SOURCE}</Source>      <MIMEType>{MIME}</MIMEType> 

{SOURCE} The location of the image on a report. {SOURCE} can be Embedded, Database , or External (this is for either Project or Web images). {MIME} A graphical format of the image.

 <Value>{EXPRESSION}</Value> 

{EXPRESSION} An expression that evaluates to an image name or a constant. For example, an {EXPRESSION} could be logo for an embedded image, logo.gif for a project-level image, =Fields!ProductImage. Value for a database image, or URL http://sc.msn.com/global/c/lgpos/MSFT_pos.gif for a web-based image.

 </Image> 

Closing tag.




Microsoft SQL Server 2005 Reporting Services
Microsoft SQL Server 2005 Reporting Services
ISBN: 0672327996
EAN: 2147483647
Year: 2004
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net