Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
81
Добавлен:
11.05.2015
Размер:
2.11 Mб
Скачать

SQL and ODBC

The Crystal Report Engine is fully compatible with most popular SQL DBMS applications, including Sybase SQL Server, Oracle, Gupta SQLBase, and Microsoft SQL Server. The Crystal Report Engine includes options for logging on to and off of SQL servers and ODBC data sources and also includes the ability to edit the SQL statement passed through to an SQL or ODBC database.

Exporting Reports

The Crystal Report Engine enables you to print to a printer or a preview window with simple function calls. In addition, you can export a file in multiple formats and to multiple destinations. For example:

through e-mail to another person or group of people

directly to disk

to HTML for updating a web site

to a Microsoft Exchange folder

to a Lotus Notes folder

to an ODBC data source

The report can be exported in any of several word processing, spreadsheet, database file, or data exchange formats including HTML.

Before using the Crystal Report Engine in your application

Before you add the Crystal Report Engine to your application, you should be familiar with some key features of the Crystal Report Engine. Review the following points, and make sure you understand each before attempting to make calls to the Crystal Report Engine from your application.

The Crystal Report Engine outputs existing reports. You can not create report files using the functionality of the Crystal Report Engine. Reports must be created using the Seagate Crystal Reports application described in the Seagate Crystal Reports User’s Guide. Make sure you understand the report creation process before trying to print reports with the Crystal Report Engine.

NOTE: Visual Basic programmers can use the Active Data Driver, along with the Crystal Report Engine API or the Crystal Report Engine Automation Server to create reports dynamically at runtime. For more information, refer to Active Data Driver, Page 118.

The Crystal Report Engine provides a convenient add-on to your existing application development project. With just a few lines of code, you can produce a powerful report writing and distribution tool that would take thousands of lines of code and weeks to produce otherwise.

The Crystal Report Engine does not require the use of a fixed user interface. The Crystal Report Engine is designed to work with your existing development project and allows you to define the user interface your customers and users are familiar with and expect from your application.

Crystal Report Engine

65

Using the Crystal Report Engine

Any development project that incorporates the Crystal Report Engine requires three steps:

Step 1: Creating reports, Page 66 (The reports that your users access.)

Step 2: Designing the user interface that drives the Crystal Report Engine, Page 66.

Step 3: Adding the Crystal Report Engine to your application, Page 67.

See also: Using the Crystal Report Engine API in Delphi, Page 68

Step 1: Creating reports

Creating reports to include with your applications is identical to creating reports for your own use; there are no restrictions. Using the procedures outlined in the Seagate Crystal Reports User’s Guide and Seagate Crystal Reports online Help, create as many kinds of reports as you want to make available to your users. You can make the reports as simple or as sophisticated as your needs dictate.

While designing reports, though, keep in mind their ultimate destination. Some export formats do not support all of the formatting options available in Seagate Crystal Reports. For example, if you will be exporting reports to HTML to automatically update a web site, HTML may not support all of the fonts available on your system. This is not a limit of the Crystal Report Engine export functionality, but a limit of the HTML format itself.

If you are a Visual Basic programmer or you are using any development environment that supports Automation Servers, you may want to have reports dynamically designed for you at runtime using the Active data driver. For complete information on using the Active data driver, see Active Data Driver, Page 118.

Visual Basic programmers can also take advantage of the Visual Basic data control or the TrueGrid ActiveX control at runtime to dynamically produce report files. See Grid Controls and the Crystal Report Engine, Page 139, for information on using these controls with the Crystal Report Engine.

Step 2: Designing the user interface that drives the Crystal Report Engine

The interface you develop to allow users to print reports is limited only by your needs and your imagination. The kind of user interface you select is unimportant to the Crystal Report Engine.

Common methods of using the Crystal Report Engine include a single menu command that produces a single report, a dialog box allowing several options for printing reports, or a completely separate front-end application that is called by your application. All are acceptable techniques, and each has its advantages. How you design your user interface can depend on any or all of the following:

The purpose of your application.

The types of reports your application will use.

The printing options you want to make available with those reports.

Whether your application will offer only one report or a choice of several reports.

Consider your application and your reporting needs carefully, and design a User Interface that will use the Crystal Report Engine most efficiently.

Crystal Report Engine

66

Step 3: Adding the Crystal Report Engine to your application

Several different Crystal Report Engine development tools can be used to add the Crystal Report Engine to your application:

Crystal ActiveX Controls, Page 108

Crystal Report Engine Automation Server, Page 111

Seagate Crystal Visual Component Library, Page 193

The Crystal Report Engine Class Library, Volume 2, Chapter 2

The Crystal NewEra Class Library, Volume 3, Chapter 7

Crystal Report Engine API, Page 68

Be aware that you can not use two or more of these tools in the same application. For example, you can not create a Visual Basic application that contains the Crystal ActiveX control and also makes calls to the functions in the Crystal Report Engine API. You must choose one tool to implement the Crystal Report Engine in your project and stick with that tool.

When choosing a Crystal Report Engine tool, consider the following:

What is your development environment?

What is your programming ability?

Do you need to implement the entire Crystal Report Engine or just a few features of it?

For example, the Crystal Class Library for NewEra is specifically designed for Informix NewEra. Therefore, if you are programming in Visual Basic, the Crystal Class Library for NewEra is not an option. The Crystal Report Engine Class Library, on the other hand, is based on the Microsoft Foundation Class Library for C++. To use the Crystal Report Engine Class Library, you must be using a C++ development tool, and you must be using the MFC library.

If you are an experienced programmer, you might consider the Crystal Report Engine API or the Crystal Report Engine Class Library. Novice programmers, on the other hand, may want to take advantage of the easy-to-use features of the Crystal ActiveX control, or the Visual Component Library.

The Crystal Report Engine API consists of a large number of functions exposed directly from the Crystal Report Engine DLL. These functions provide a wide range of power and flexibility for adding report writing features to your own applications.The rest of this chapter discusses the process required to use the Crystal Report Engine API in your own applications.

Although the examples in the following sections concentrate on the C programming language, the concepts should be studied by anyone using the API functions in any language. Additional information specific to Visual Basic programmers using the API can be found in Using the Crystal Report Engine API in Visual Basic, Page 104. Additional information for Delphi programmers is located in Using the Crystal Report Engine API in Delphi, Page 68. If you wish to use a Crystal Report Engine development tool other than the Crystal Report Engine API, refer to the table of contents for this manual, or search for the name of the programming language or development environment you are using in Developer’s online Help.

Crystal Report Engine

67

Соседние файлы в папке crystal