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

Connecting from VBScript

The following code assumes you have added the Crystal Smart Viewer for ActiveX to a web page using the <OBJECT> tag and assigned it an ID of CRViewer. For an example of this, refer to ActiveX Viewer Example, Volume 1, Chapter 3.

<OBJECT ID="WebSource" Width=0 Height=0> CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C" CODEBASE="viewer/ActiveXViewer/swebrs.dll#Version=1.2.0.5"

</OBJECT>

<OBJECT ID="WebBroker" Width=0 Height=0> CLASSID="CLSID:F2CA2119-C8D2-11D1-BEBD-00A0C95A6A5C" CODEBASE="viewer/ActiveXViewer/swebrs.dll#Version=1.2.0.5"

</OBJECT>

<OBJECT ID="Export" Width=0 Height=0> CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C" CODEBASE="viewer/ActiveXViewer/sviewhlp.dll#Version=1.0.0.4"

</OBJECT>

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

Sub Page_Initialize Dim webBroker Dim webSource

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

webSource.URL = Location.Protocol + "//" + Location.Host + _ "/scrreports/xtreme/invent.rpt"

CRViewer.ReportSource = webSource CRViewer.ViewReport

End Sub --> </SCRIPT>

The Crystal Smart Viewer Java Bean

The Seagate Crystal Smart Viewer Java Bean (or Smart Viewer Bean) can be added to an application in any development environment that supports Java ( version 1.1). Programmers receive the benefit of quickly adding a powerful report viewer to an application with little coding.

As a standard component, the Crystal Smart Viewer Java Bean exposes several properties at design time, but also provides a complete object model with properties, methods, and events that can be programmed at runtime. The following discusses one approach to creating an application using the Crystal Smart Viewer Java Bean. It describes the creation of a simple Applet which will allow a report to be viewed from your browser.

Using Crystal Smart Viewers in Applications

9

This example uses the Bean Box a component of the Bean Developer Kit (BDK) from Sun Microsystems Inc. The Bean Box is not intended to be used for serious application development, rather as a platform for testing Beans interactively at design time, and creating simple applets for run time testing. The Bean Box is available for download from Sun Microsystems.

Adding the Smart Viewer Bean to the project

To add the smart Viewer Bean to the Bean Box:

1Locate the JAR file called ReportViewerBean.jar in the "Viewers" directory (\SeagateSoftware\Viewers\JavaViewerBean)

2Either copy the file to the \jars subdirectory of the BDK

or

From the Bean Box Select LoadJar from the File menu and specify the pathname of the file

3The Crystal Smart Viewer Icon should appear in the ToolBox palette.

Creating a simple applet with the Smart viewer

To add the Smart Viewer Bean to the Bean Box Composition window and create an applet:

1Click on the Smart Viewer Beans name (Crystal Smart Viewer) in the ToolBox palette.

2Click on the location in the Bean Box Composition window where you want the Smart Viewer Bean to appear.

3Resize the Smart Viewer in the Composition window until you are able to see the controls and report window.

4In the Bean Box Property Sheet window you will see the list of Smart Viewer Bean properties. These can be set and edited. For example to view a report click on the reportName property. When the dialog box appears enter the URL of a report file (for example: "http://localhost/scrreports/craze/adcont2s.rpt"). The report should be displayed in the Crystal Smart Viewer Report window.

5To create a simple applet select MakeApplet from the File menu. This will create an applet which when called from your browser will display the report specified in the reportName property. You will be prompted to specify a directory where your applet and its supporting file will be placed (or the default tmp subdirectory of the beanbox directory).

If you look at the directory containing the applet, you will notice that there are a number of supporting files and directories. Locate the html file (<appletname>.html) and click on it. Your default browser should display the Smart Viewer and the report.

The minimum required to actually run the application using the bean is:

the html file which references the applet class file

the extracted ReportViewerBean.jar file and any supporting jar files

the applet class file

Using Crystal Smart Viewers in Applications

10

Volume 3

 

2

Report Designer Component

 

Object Model

What you will find in this chapter...

Overview of the Report Designer Object Model, Page 12

...including Object naming conflicts. Objects and Collections, Page 12

...including the Objects and Collections, Properties and Methods listed alphabetically.

Report Designer Component Object Model

11

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