ActiveReport Designer Studio™ Online Tutorial

Home-> Tutorial->Deploy report to web

Now, you will learn how to deploy the rpx file in your web site using ReportExpress' ActiveX viewer. As previous step, you have "myfirstreport.rpx" which bound xml meta file.

Get the ReportExpress' Viewer   

Get the ActiveReport Designer Studio    Download

1. Create new sub-folder named example under newhome. In this "newhome" folder, you already made "rpxFiles" folder for save the "myfirstreport.rpx".

2. Create new html page and edit following and save as "example01.html"

<html>
<head>
<title>Example01</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<Script language="vbscript">
function reportView()
Dim hostip

var hostip = window.location.host

    Viewer1.Initialize
    Viewer1.Server = "http://" + hostip + "/newhome/"
    Viewer1.ReportLayout = "myfirstreport.rpx"
    Viewer1.FileUrl="http://" + hostip + "/newhome/xml/customer.asp"
    Viewer1.RunViewer
end function
</script>
</head>

<body>
<p>
<input name="button1" type="button" id="button1" onclick="reportView()" value="Click!" />
</p>
<!--// ReportExpress FreeViewer install //-->
<OBJECT ID="Viewer1"
CLASSID="CLSID:89150B7A-45A8-457D-927E-D1227DF809DC"
CODEBASE="/eng/ActiveX/refree.cab#version=1,0,0,3"
STYLE="display: none">
</OBJECT>
</body>
</html>

Click button to show the example01.html

In above example code, you'll find the ReportExpress' Viewer component and it's synopsis.

Viewer1.Server :
Server property is the location of rpx files. You have to ommit the “rpxFiles” directory. i.e, if your rpx file's real location is http://www.aaa.com/report/rpxFires/test.rpx, then Viewer.Server=”http://www.aaa.com/report/”. Note that server property end with “/” . At run time, Viewer's inet object request the rpx file for generating report.

Viewer1.ReportLayout :
Define the rpx file's name property. ReportLayout value(string) will be add to Server property(string). Server+ReportLayout string is complete URL which can get the rpx files.
Note: rpxFiles directory was hidden. i.e, “Server + rpxFiles + ReportLayout”.

Viewer1.FileUrl :
After design the report using XML data control(named dc), you can set the dc's URL and RecordSetPattern(XPath) using FileUrl and Xpath properties at runtime. Using FileUrl, you can pass the arguments to Viewer's XML datasource. If you specify the FileUrl, then Viewer will be reference the XML Data as FileUrl property. If not specify the FileUrl, then Viewer will be reference the dc's FileUrl at design time.

Viewer1.RunViewer() :
This method will be generate report on the client-side ReportExpress viewer. Also you can get the information of printing status using Successful() method.

<html>
<head>
<title>Example01</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<Script language="Javascript">
<!--
function RunView_onclick() {
var PrintSuccessful;
var hostip = window.location.host ;
    Viewer1.Initialize ;
    Viewer1.Server = "http://" + hostip + "/newhome/" ;
    Viewer1.ReportLayout = "myfirstreport.rpx" ;
    Viewer1.ViewToolBar=0;
    Viewer1.Debugging=1;
    Viewer1.FileUrl="http://" + hostip + "/newhome/xml/customer.asp" ;
    Viewer1.XPath="//customers";
    Viewer1.RunViewer() ;
    PrintSuccessful=Viewer1.Successful();

    if (PrintSuccessful=1) {
        alert (“Printing success!\n”) ;
    } else {
        alert (“Printing fail!\n”);
    }
}
//-->
</script>
</head>

<body>
<p>
<input id=RunView type=button value="Print recieve" name="RunView" LANGUAGE=javascript onclick="RunView_onclick();">
</p>

<!--// ReportExpress FreeViewer install //-->
<OBJECT ID="Viewer1"
CLASSID="CLSID:89150B7A-45A8-457D-927E-D1227DF809DC"
CODEBASE="/eng/ActiveX/refree.cab#version=1,0,0,3"
STYLE="display: none">
</OBJECT>
</body>
</html>

You can find detail information of ReportExpress' Viewer in the ReportExpress Viewer online help.

Previouse  Next
Copyright 2003 Cabsoftware, Inc. and its licensors. All rights reserved. www.cabsoftware.com