As we all know Microsoft released IE browser security patch this year, users cannot directly interact with Microsoft ActiveX controls loaded by the APPLET, EMBED, or OBJECT elements. The solution is using Microsoft JScript to load controls from external script files. I tried this solution for Crystal Report Active X viewer, but no luck. Below is my code.
Report main page
**********************************************
<HTML>
<HEAD>
<TITLE>Seagate ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD="Page_Initialize">
<div id="DivID">
<script src="createRptViewerExplicit.
js"></script>
<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 = "rptserver.asp"
else
Dim webSource
Set webSource = CreateObject("WebReportSource.WebReportSource")
webSource.ReportSource = webBroker
webSource.URL = "rptserver.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
</BODY>
</HTML>
*******************************************
external
JS file:
*********************************************
var myObject = document.createElement('object');
DivID.appendChild(myObject);
myObject.ID="CRViewer";
myObject.width = "100%";
myObject.height = "95%";
myObject.CODEBASE="activexviewer.cab#Version=8,0,0 ,224";
myObject.classid= "CLSID:C4847596-972C-11D0-9567-00A0C9273C2A";
myObject.EnableRefreshButton = 0;
myObject.EnableGroupTree=0;
myObject.DisplayGroupTree = 0;
myObject.EnablePrintButton=1;
myObject.EnableExportButton = 0;
myObject.EnableDrillDown=0;
myObject.EnableSearchControl = 1;
myObject.EnableAnimationControl=1;
myObject.EnableZoomControl=2;
*************************************************
I use the similar code to make flash work, but not working for crystal report. Does anybody know how to make this work?
Thanks.
Wen