Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling CR Viewer from our application

Status
Not open for further replies.

DrHabi

Technical User
Jan 22, 2002
103
0
0
US
For over 13 years ( using Crystal 6 through 11.5)we have called the viewer through an ActiveX call using this code and now it is something no longer available to CR2008 > . We still create the report fine but can no longer call the browser to open the rpt with the active x. Anyone no what we need to do to get this working. I am having a difficult time figuring it out since this is most likely a call to a web folder.

<%@ Language=VBScript CodePage=65001 %>

<%

session("rname")=trim(request("rname"))

reportName = "../xreports/" & trim(request("rname"))


Set objFactory = CreateObject("CrystalReports.ObjectFactory")


Dim path, iLen
path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(path, 1) <> "\" And Len(path) <> 0)
iLen = Len(path) - 1
path = Left(path, iLen)
Wend

' Create a new ReportClientDocument object
Set Session("oClientDoc") = objFactory.CreateObject("CrystalClientDoc.ReportClientDocument")

' Specify the RAS Server (computer name or IP address) to use (If SDK and RAS Service are running on seperate machines)
Session("oClientDoc").ReportAppServer = "localhost"

' Open the report object to initialize the ReportClientDocument
Session("oClientDoc").Open path & reportName


Response.Redirect "activexv.asp"



%>

this is my activexv.asp code


%
' Copyright © 2004 Eatec Corporation
'

%>
<HTML>
<HEAD>
<TITLE>Crystal Reports ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 topmargin=0 leftmargin=0>

<OBJECT ID="CRViewer"
CLASSID="CLSID:6F0892F7-0D44-41C3-BF07-7599873FAA04"
WIDTH=100% HEIGHT=100%
CODEBASE="/crystalreportviewers115/activeXcontrols/activexviewer.cab#Version=11,5,3,438" VIEWASTEXT>
<PARAM NAME="EnableRefreshButton" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=0>
<PARAM NAME="EnableDrillDown" VALUE=0>
<PARAM NAME="EnableSearchControl" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=0>
<PARAM NAME="EnableZoomControl" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</OBJECT>


<SCRIPT LANGUAGE="VBScript">
<!--
dim timer
dim printerTimer
dim pageOne
PageOne = True

Sub Window_Onload
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("CrystalReports115.WebReportBroker.1")
If ScriptEngineMajorVersion < 2 Then
window.alert "IE 3.02 users need to get the latest version of VBScript or install IE 4.01 SP1 or newer. Users of Windows 95 additionally need DCOM95. These files are available at Microsoft's web site."
else
Dim webSource
Set webSource = CreateObject("CrystalReports115.WebReportSource.1")
webSource.ReportSource = webBroker
webSource.URL = "rptserver.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
End If
CRViewer.ViewReport
End Sub




Sub CRViewer_DownloadFinished(byval downloadType)
if downloadType = 1 and PageOne then
PageOne = False
<!-- timer = window.settimeout("OnMyTimeOut",1000) -->
'window.alert "DownloadFinished"
window.status = "downloadfinished"
end if
end sub


Sub OnMyTimeOut()
if not CRViewer.IsBusy then
window.ClearTimeout(timer)
'window.alert "My timeout"
CRViewer.PrintReport
printerTimer = window.SetTimeOut("OnPrinterTimeOut", 10000)
end if
end sub

Sub OnPrinterTimeOut()
'window.alert "OnPrinterTimeout"

if not CRViewer.IsBusy then
window.ClearTimeOut(printerTimer)
'window.History.Back
window.status = "done"
end if
end sub
-->
</SCRIPT>
<script language="javascript">
function CallDestroy()
{
window.open("Cleanup.asp");
}
</script>




<div>
<!-- This empty div prevents IE from showing a bunch of empty space for the controls above. -->
</div>
<!-- <% = "<p align=""center""><br><br><br><img src="" alt=""Eatec"" WIDTH=""246"" HEIGHT=""112""><p align=""center""><b>Report " & trim(request("rname")) & " printing</b>" %> -->
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top