How to display images in a crystal report?

Source: Internet
Author: User
Tags ole

Usually we need to display text and digital data in the crystal report. Sometimes, the database contains image data, and we also want to use it in the crystal report. There are many ways to display data-driven images in reports

First, make sure that the image has sufficient size and quality. It is meaningless to try to display high-quality large images as a thumbnail in a report. Use the image editing program to create an image that you can display at an appropriate resolution and size.

The format of the image is also important. Although BMP is a quite common format, it takes up a lot of space. Therefore, it is necessary to convert an image to a compression format similar to jpg or GIF. Crystal Reports support all these formats.

The next problem to be solved is how to put the image into a crystal report. In the past, we thought the only answer was to use the database. However, there are many other ways. Let's take a look at the three methods ......

1. database solution:Easy to implement, but requires a lot of disk space.

You can store image data in database fields. These fields in Microsoft Access are called Ole fields, while Oracle and SQL Server call them blob (Binary Large Object) fields.

An example of this technology is the Xtreme instance database provided by the crystal report. In the "employee" table, there is a field containing Employee photos named "Employee photos ". You only need to insert these fields into the report in the same way as using other fields.

On the good side, you can directly associate image fields with database data. On the bad side, these images will occupy a considerable amount of database space. This means they also have adverse effects on performance and storage.

2. developer solutions:Limited Functions and a developer is required.

In some crystal report books, we read how to use programming languages (such as Visual Basic) to write a crystal report viewer. In a program, you can capture events such as "formatting section", and then change the OLE object in the report to load different images.

On the good side, this allows you to loosely couple data and images. The downside is that complex programs need to be developed and can only be used with specific reports. We are considering developing such a viewer until we encounter the following two technologies. Recently, we have heard that these formatting events in crystal report 9 are not available to developers.

3. Drive Solution:Fast and flexible third-party products.

One of the great features in Crystal Reports 8 and 9 is that you can use the com data source. This means that you can use the program code to create a record set and use it as the report data source.

We developed a cviewimage (http://www.crystalkeen.com/tools/cviewimage.htm), a com data source that can read three fields (identifiers, descriptions, and image file names) from any ODBC table. The com data source will create the fourth field, including the image corresponding to the file name. You can use it to display images in the subreport table.

The biggest benefit of this solution is that the entire record set is loaded into the memory, so images can be quickly loaded and processed, and it is flexible to use those images and database fields. It only needs one ODBC data source.

On the bad side, it requires some initialization settings to locate the image, but we have made the drive flexible enough so that you can support multiple configurations. You can even create an extended version to include all the other fields in the table. Let us know if this is valuable.

4. Distribution solution:Installing UFL is simple and inexpensive.

Another solution is to export to HTML using our SMTP User function library (http://www.crystalkeen.com/tools/mailfunctionlibrary_smtp.htm ). We also have other user function libraries that can send output to outlook, XML, or disk files. Some people refer to this as "report pulse". Here, your report engine uses a function library to generate multiple output files.

Currently, we have an SMTP library that can embed images into HTML messages during report processing. This is a standard feature of our SMTP library.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.