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

ActiveX Viewer Example

The following HTML code demonstrates one means of embedding the Crystal Smart Viewer for ActiveX in a web page using the OBJECT tag:

<OBJECT ID="CRViewer" CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A" WIDTH=100% HEIGHT=95%

CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=2,2,4,36"> <PARAM NAME="EnableRefreshButton" VALUE=1>

<PARAM NAME="EnableGroupTree" VALUE=1>

<PARAM NAME="DisplayGroupTree" VALUE=1>

<PARAM NAME="EnablePrintButton" VALUE=1>

<PARAM NAME="EnableExportButton" VALUE=1> <PARAM NAME="EnableDrillDown" VALUE=1> <PARAM NAME="EnableSearchControl" VALUE=1>

<PARAM NAME="EnableAnimationControl" VALUE=1> <PARAM NAME="EnableZoomControl" VALUE=1> </OBJECT>

<SCRIPT LANGUAGE="VBScript"> <!--

Sub Page_Initialize On Error Resume Next Dim webBroker

Set webBroker = CreateObject("WebReportBroker.WebReportBroker") if ScriptEngineMajorVersion < 2 then

window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE

3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are

available at Microsoft's web site."

CRViewer.ReportName = Location.Protocol + "//" + Location.Host + Location.Pathname

else

Dim webSource

Set webSource = CreateObject("WebReportSource.WebReportSource") webSource.ReportSource = webBroker

webSource.URL = Location.Protocol + "//" + Location.Host + Location.Pathname

webSource.PromptOnRefresh = True CRViewer.ReportSource = webSource

end if CRViewer.ViewReport

End Sub --> </SCRIPT>

Configuring the Crystal Smart Viewers

61

This example will display a Group Tree to allow Smart Navigation. Additionally, the user can drill-down on summary reports, refresh report data, and print the report to a printer.

Notice that reports can not be directly assigned to the ActiveX viewer. For information on using the ActiveX viewer inside web pages, see Customizing the Crystal Smart Viewer, Page 47. For information on using the ActiveX viewer inside other applications and development environments, see Seagate Crystal Smart Viewer for ActiveX, Volume 3, Chapter 1.

Configuring the Crystal Smart Viewers

62

Volume 1

 

4

Crystal Report Engine

What you will find in this chapter...

Introduction to the Crystal Report Engine, Page 64

...including comments about sample applications, SQL and ODBC, and exporting reports.

Before using the Crystal Report Engine in your application, Page 65

Using the Crystal Report Engine, Page 66

...including creating reports, designing the user interface, adding the Crystal Report Engine to your application, and applications in Delphi.

Crystal Report Engine API, Page 68

...including declarations; using the API; Print-Only and Custom-Print Links; and working with parameter values and ranges, section codes including Visual Basic, variable length strings, API structures, subreports and report formats.

Exporting reports, Page 94

...including comments about PEExportTo function and PEExportOptions structure.

Handling Preview Window Events, Page 97

Distributing Crystal Report Engine Applications, Page 102

Additional Sources of Information, Page 102

Crystal Report Engine

63

Introduction to the Crystal Report Engine

The following topics are included in this introduction:

Sample Applications, Page 64

SQL and ODBC, Page 65

Exporting Reports, Page 65

Besides acting as a powerful stand-alone report creation application, Seagate Crystal Reports provides a report writing module that you can add to your own applications. As a developer using C, C++, Visual Basic, ObjectVision, Turbo Pascal, Visual dBASE, Delphi, or any programming language that can access a DLL, you can add sophisticated report generating and printing capabilities to your applications without the timeconsuming task of writing your own code.

The Crystal Report Engine is a Dynamic Link Library (DLL) that allows your applications to access the same powerful report printing features that are available in Seagate Crystal Reports. As a licensed user of Seagate Crystal Reports, you receive royalty-free rights to ship the Crystal Report Engine DLL (CRPE.DLL or CRPE32.DLL) and all of its support files with any application you create.

NOTE: For more information regarding current runtime file requirements, see the Runtime File Requirements online Help.

From your application, you can access the Crystal Report Engine through any of several Crystal Report Engine development tools:

Crystal ActiveX Controls, Page 108 (CRYSTL16.OCX or CRYSTL32.OCX)

Crystal Report Engine Automation Server, Page 111 (CPEAUT.DLL or CPEAUT32.DLL)

Seagate Crystal Visual Component Library, Page 193 (UCRPE.DCU or UCRPE32.DCU)

The Crystal Report Engine Class Library, Volume 2, Chapter 2 (PEPLUS.H and PEPLUS.CPP)

The Crystal NewEra Class Library, Volume 3, Chapter 7

Crystal Report Engine API, Page 68 (CRPE.DLL or CRPE32.DLL)

When your application runs, it links with the Crystal Report Engine to access report writing functionality. Reporting can be simple, producing only a single report that is sent to a printer or preview window with no options available to the user, or it can be complex, allowing the user to change such things as record selection, sorting, grouping, or export options.

NOTE: All references to CRPE32.DLL are for the 32-bit version. If you plan on using the 16-bit version, it is called CRPE.DLL.

Sample Applications

Seagate Crystal Reports comes with a number of sample applications that show you how to incorporate the capabilities of the Crystal Report Engine. Use these applications to further your understanding of the Crystal Report Engine and how to use it in various programming environments.

Crystal Report Engine

64

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