Solved

Crystal Reports Viewer 11

Posted on 2007-11-20
15
7,918 Views
Last Modified: 2008-05-08
Hi,
I want to know if we can use crystalreportviewers115 instead of cystalreportviewers11.
I am calling my crystal reports from ASP.
I am new to crystal reports,any help is greatly appreciated.
Thank you
0
Comment
Question by:SenthilKavitha
  • 7
  • 3
  • 2
  • +1
15 Comments
 
LVL 5

Expert Comment

by:mfsamuel
ID: 20323448
Crystal Reports XI = crystalreportviewers11
Crystal Reports XI R2 = crystalreportviewers115

Each viewer is designed to work with a different version of Crystal.  XI R2 is a different than XI.  If you are interfacing with just the report aspects they should both work.  If you are dealing with a BI server you should use the version that matches.

Here is a link showing the different versions.
http://devlibrary.businessobjects.com/businessobjectsxir2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crconsetupdevviewersvirtualdirectory.htm

If you are using Visual Studio to develop you should have an integrated viewer as part of the distribution.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 20324581
What version of Crystal?

XI R2 was d\released to allow CR XI to be used with VS2005 since VS2005 requires the .Net 2.0 framework.

mlmcc
0
 

Author Comment

by:SenthilKavitha
ID: 20327431
I think I should rephrase my question, I have created reports in Crystal Reports 11 and was using crystalreportviewers11 on webserver to access the reports.Now we have moved the webserver to a new box and it has only crystalreportviewers115.
Can I still keep my reports in 11 and view it in crystalreportviewers115?
I am using the following code

 <OBJECT ID="CRViewer"
      CLASSID="CLSID:460324E8-CFB4-4357-85EF-CE3EBFE23A62"
      WIDTH="550" HEIGHT="375"
      CODEBASE="/viewer115/ActiveXControls/ActiveXViewer.cab#Version=11,5,3300,0" VIEWASTEXT>
<PARAM NAME="EnableRefreshButton" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<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">
          On Error Resume Next
          Dim webBroker
          Set webBroker = CreateObject("CrystalReports11.WebReportBroker.1")
      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."
            webSource.URL = "RDCrptserver11.asp"
            else
            Dim webSource
            Set webSource = CreateObject("CrystalReports11.WebReportSource.1")
            webSource.ReportSource = webBroker
            webSource.URL = "RDCrptserver11.asp"
            webSource.PromptOnRefresh = True
            CRViewer.ReportSource = webSource
            
            end if
            CRViewer.ViewReport
      </script>
0
 
LVL 5

Expert Comment

by:mfsamuel
ID: 20327641
It should work fine.  Have you had problems?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 20330705
You may have to change the Crystal references to use the 115 assemblies.  The names are the same except for the version number.

mlmcc
0
 

Author Comment

by:SenthilKavitha
ID: 20330847
I am using the exact same code,where the version number is that of 115.
viewer115 is the virtual directory I created to point to 3.5 crytsal viewer.
I am getting a Red Cross Sign when I call the report. I tried all options listed on kbb.
Can you tell me where I could be going wrong?

mlmcc : I did not understand how to  change the Crystal references to use the 115 assemblies? Please explain. If you have examples,that would be great.
Thank you
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 100

Expert Comment

by:mlmcc
ID: 20336963
I don't know how to change the references.

I believe if the assemblies exist you simply need to change the names like
        Set webBroker = CreateObject("CrystalReports115.WebReportBroker.1")

mlmcc
 
0
 

Author Comment

by:SenthilKavitha
ID: 20357661
I changed the assemblies but still the report does not show,it gives me a blank screen with a red cross sign. Anyone  who has done a similar change,if you can give examples,that would be great.Thanks
0
 

Author Comment

by:SenthilKavitha
ID: 20357951
Also do I need to change the class id of CRViewer,if so where do I find it.
0
 

Author Comment

by:SenthilKavitha
ID: 20358179
Here is my code
<%
'******************************************************************************
'Class Name: PrintRPT
'Description: Displays the Crystal Reports ActiveX window
'******************************************************************************
class PrintRPT
'================================   PUBLIC   ==================================
'-------------------   PROPERTIES   ---------------------
public ErrorText 'ErrorDescription

'--------------------   METHODS   -----------------------
'********************************************************
'PrintFile - displays the activex window
'  FileName - name of the rpt file (in the reports directory)
'********************************************************
public property get RecordCount()
   
      RecordCount=Session("oRs").RecordCount
      
end property

public sub PrintFile(FileName)
 
   If Session("WIN2K_LESS") = 0 Then
      FileName=GetPath() & FileName
       'Session("MyVar") = "File name with path:" & FileName
      Set session("oRpt") = session("oApp").OpenReport(FileName, 1)
       'Session("MyVar") = "session of oRpt in PrintFile"
      'set session("oRptOptions") = Session("oRpt").Options


      session("oRpt").MorePrintEngineErrorMessages = False
      session("oRpt").EnableParameterPrompting = False

       'Session("MyVar") = "Creating oRptOptions session, setting print engine error messages."
      'session("oRptOptions").MorePrintEngineErrorMessages = 0
      session("oRpt").DiscardSavedData
      set Table1 = session("oRpt").Database.Tables.Item(1)
      Table1.SetPrivateData 3, session("oRs")
            
      set session("oPageEngine") = session("oRpt").PageEngine
      'Session("MyVar") = "Page Engine Created."
  Else
    FileName=GetPath() & FileName
      Set session("oRpt") = session("oApp").OpenReport(FileName, 1)
      set session("oRptOptions") = Session("oRpt").Options
      session("oRptOptions").MorePrintEngineErrorMessages = 0
      session("oRpt").DiscardSavedData
      set Table1 = session("oRpt").Database.Tables.Item(1)
      Table1.SetPrivateData 3, session("oRs")
            
      set session("oPageEngine") = session("oRpt").PageEngine
  End if
      
      
      If Session("WIN2K_LESS") > 0 Then
      %>

      <object ID="CRViewer" CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"    codebase="/viewer/activexviewer/activexviewer.cab#Version=2,2,4,37" width="550" height="375" VIEWASTEXT>
            <param NAME="EnableRefreshButton" VALUE="0">
            <param NAME="EnableGroupTree" VALUE="0">
            <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">
      <!--
            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 +"/scrreports/rptserver.asp"
                  CRViewer.ReportName = Location.Protocol + "//" + Location.Host +"/Paternity/rptserver.asp"
            else
                  Dim webSource
                  Set webSource = CreateObject("WebReportSource.WebReportSource")
                  webSource.ReportSource = webBroker
                  'webSource.URL = Location.Protocol + "//" + Location.Host + "/scrreports/rptserver.asp"
                  webSource.URL = Location.Protocol + "//" + Location.Host + "/Paternity/rptserver.asp"
                  webSource.PromptOnRefresh = True
                  CRViewer.ReportSource = webSource
            end if
            CRViewer.ViewReport
      -->
      </script>
 <%
 elseIf (Session("WIN2K_LESS") = 0) Then
 %>
 
  <OBJECT ID="CRViewer"
      CLASSID="CLSID:460324E8-CFB4-4357-85EF-CE3EBFE23A62"
      WIDTH="550" HEIGHT="375"
      CODEBASE="/crystalreportviewers115/ActiveXControls/ActiveXViewer.cab#Version=11,5,3,417" VIEWASTEXT>
<PARAM NAME="EnableRefreshButton" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<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">
          On Error Resume Next
            Dim webBroker
            'Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
            'Set webBroker = CreateObject("CrystalReports11.WebReportBroker.1")
            Set webBroker = CreateObject("CrystalReports115.WebReportBroker.1")
            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 +"/scrreports/rptserver.asp"
                  'CRViewer.ReportName = Location.Protocol + "//" + Location.Host +"/Paternity/rptserver.asp"
                  'CRViewer.ReportName = Location.Protocol + "//" + Location.Host +"/Paternity/RDCrptserver11.asp"
                  webSource.URL = "RDCrptserver11.asp"
            else
                  Dim webSource
                  'Set webSource = CreateObject("WebReportSource.WebReportSource")
                  Set webSource = CreateObject("CrystalReports115.WebReportSource.1")
                  webSource.ReportSource = webBroker
                  'webSource.URL = Location.Protocol + "//" + Location.Host + "/scrreports/rptserver.asp"
                  'webSource.URL = Location.Protocol + "//" + Location.Host + "/Paternity/rptserver.asp"
                  'webSource.URL = Location.Protocol + "//" + Location.Host + "/Paternity/RDCrptserver11.asp"
                  webSource.URL = "RDCrptserver11.asp"
                  webSource.PromptOnRefresh = True
                  CRViewer.ReportSource = webSource
                  
            end if
            CRViewer.ViewReport
      </script>

       
<%
end if

end sub

'*******************************************************
' Function Name: PrintExcelReport
' Description: Print out a editable count per county in excel
'*******************************************************
public sub PrintExcelReport()
      Response.ContentType = "application/vnd.ms-excel"

      Dim  j, i

      %>

      <table border=1>
        <tr>
       <%
         ' *****************************************************
         ' * Loop through Fields Names and print out the Field Names
         ' *****************************************************
      
          j = 2 'row counter
          For i = 0 to Session("oRs").Fields.Count - 1
       %>
          <TD><B><% = Session("oRs")(i).Name %></B></TD>
          <% Next %>
          </TR>
          
      <%
         ' *****************************************************
         ' * Loop through rows
         ' *****************************************************
      Do While Not Session("oRs").EOF %>

         <TR>
        
      <% For i = 0 to Session("oRs").Fields.Count - 1 %>

          <TD VALIGN=TOP><% = Session("oRs")(i) %></TD>
          
      <%
          Next
      %>
         </tr>
      <%
          Session("oRs").MoveNext
          j = j + 1
          Loop

      %>
          <tr>
            <td>&nbsp</td>
            <td>=SUM(B2:<%="B" & j-1%>)</td>
            <td>=SUM(C2:<%="C" & j-1%>)</td>
            <td>=SUM(D2:<%="D" & j-1%>)</td>
            <td>=SUM(E2:<%="E" & j-1%>)</td>
            <td>=SUM(F2:<%="F" &j-1%>)</td>
            <td></td>
            <td></td>
          </tr>
        </table>
<%
end sub
'*******************************************************
'Function Name: SetSessionData
'Description: Sets the connection string and query for subsequent calls to
'      PrintFile - Data is stored in a session recordset (as required by CRE)
'      so it is persistant unless SetSessionData is called again.
'*******************************************************
public sub SetSessionData(ConnString, Query)
            'GetData
            Dim Conn
                  if( Session("oRs").state=1 ) then'check if the recordset is open
                        Session("oRs").CancelBatch
                        Session("oRs").close
                  end if
            'Session("MyVar") = Query      
            set Conn=Server.CreateObject("ADODB.Connection")
            Conn.CommandTimeout=80
            Conn.Open ConnString
            Session("oRs").Open Query,Conn,3,3
            Session("oRs").ActiveConnection=nothing 'disconnect the recordset
            Conn.Close
end sub
'================================   PRIVATE  ==================================
'-------------------   VARIABLES   ---------------------


'-------------------   FUNCTIONS   ---------------------
'*******************************************************
'Function Name: Class_Initialize
'Description: function to automatically run on object instantiation
'*******************************************************
private sub Class_Initialize
      If IsObject(session("oApp")) then
            Set session("oApp") = nothing
      End if
      'Based on the Client Operating System.
      If Session("WIN2K_LESS")=0 Then                              
       Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
    Else
       Set session("oApp") = Server.CreateObject("Crystal.CRPE.Application")
    End if
   
      
            
      If IsObject(session("oRpt")) then
            Set session("oRpt") = nothing
      End if
      
      If IsObject(session("oPageEngine")) Then                              
              set session("oPageEngine") = nothing
      End If
      
end sub

'*******************************************************
'Function Name: Class_Terminate
'Description: function to automatically run on object destruction
'*******************************************************
private sub Class_Terminate
end sub

'*******************************************************
'Function Name: GetPath
'Description: Gets the filesystem path for the web app
'*******************************************************
private function GetPath
   
      GetPath = Request.ServerVariables("PATH_TRANSLATED")                    
      While (Right(GetPath, 1) <> "\" And Len(GetPath) <> 0)                      
            iLen = Len(GetPath) - 1                                                  
            GetPath = Left(GetPath, iLen)  
      
      Wend
      
end function


end class
%>
0
 

Author Comment

by:SenthilKavitha
ID: 20358197
Here is my RDCrptserver11.asp

<%

'      This script assumes that the Session contains the following Crystal Report Engine
'      Objects:
'
'      "oApp" - Crystal Report Engine Application Object
'      "oRpt" - Crystal Report Engine Report Object
'      "oPageEngine - Crystal Report Engine Page Engine Object

 On Error Resume Next

'  The oEMF object is a helper object to create EMFs (Ecapsulated Messages) for the viewers.
'  The viewers use EMFs to display errors and navigate to specific pages of the report.

 If Not IsObject(session("oEMF")) then
      Set session("oEMF") = Server.CreateObject("CrystalReports115.EMFGen.1")
      Call CheckForError
 End if


'      Initialize all Global variables
'      These will contain the page generator and page collection

      Dim goPageGenerator            ' page generator object
      Dim goPageCollection      ' page collection object
      Dim goPageGeneratorDrill' page generator object in Drill Down Context
      Dim goPage                        ' the page object
      Dim gvGroupPathDD            ' drill down group path, this is an array.
      Dim gvGroupPath                  ' this is branch, aka Group Path converted from string passed on the QS, it is an Array
      Dim gvGroupLevel            ' this is the Group level, converted from the string passed on the QS, it is an Array
      Dim gvMaxNode                  ' this represents the number of nodes to retrieve for the totaller, it is set to an empty array
      Dim gvTotallerInfo            ' this represents the group path of the requested totaller.
      Dim glX                              ' this is the X Coordinate for a drill down on a graph or Map
      Dim glY                              ' this is the Y Coordinate for a drill down on a graph or Map
      Dim gvPageNumber            ' holds the requested page number
      Dim gvURL                        ' URL to redirect to
      Dim gsErrorText                  ' holds the error text to be sent to the viewer.
      Dim ExportOptions            ' Export Options Object
      Dim slX                              ' this is the X Coordinate for a selection of Out of Place subreport
      Dim slY                              ' this is the Y Coordinate for a selection of Out of Place subreport
      Dim sessionError            ' this is the variable that will contain the error text sent to the viewer when the session has expired.

' Vaiables that represent what was passed on the Query String
      Dim CMD                              ' This determines the main function to perform
      Dim PAGE                        ' the page to return
      Dim BRCH                        ' the branch is a mechanism to determine the drill down level.
                                          ' A drill down level is like a view of the report, a new tab
                                          ' is created to indicate that it is a new view
      Dim VIEWER                        ' This is the viewer that is calling the server
      Dim VFMT                        ' the format that the viewer understands
      Dim NODE                        ' Currently not used??
      Dim GRP                              ' this is a way of specifing the actual group
      Dim COORD                        ' these are the coordinates on the graph to process
      Dim DIR                              ' this is the search direction
      Dim CSE                              ' indicates if the search is case sensitive
      Dim TEXT                        ' this is the text to search for.
      Dim INIT                        ' used to build the frames for the html viewer
      Dim NEWBRCH                        ' used to keep track of when a new branch is to be viewed.
      Dim EXPORT_FMT                  ' used to hold the export format and type
      Dim SUBRPT                        ' used to hold the Out Of Place Subreport page, number,
                                          ' and coordinates on the main report.
      Dim INCOMPLETE_PAGE            ' used to indicate whether the page generated should contain placeholders.
      Dim INCOMPLETE_PAGE_COUNT ' used to indicate whether the page should contain the total page count if not yet generated.
      Dim PVERSION                  ' used to indicate the protocol version of the viewer.
      Dim TTL_INFO                  ' used to indicate the group path of the totaller request.
      Dim IMAGE                        ' used to specify the name of the image file for html viewers.
      Dim DEL                              ' used to specify whether to delete image file after it has been sent to client.
      
' Constant Values
      Dim CREFTWORDFORWINDOWS
      Dim CREFTRICHTEXT
      Dim CREFTEXCEL21
      Dim CREFTEXCEL70
      Dim CREFTCRYSTALREPORT
      Dim CREFTPORTABLEDOCFORMAT
      Dim CREDTDISKFILE
      Dim EMFMIMETYPE            
      CREFTWORDFORWINDOWS = 14
      CREFTRICHTEXT = 35
      CREFTEXCELDATAONLY = 38
        CREFTEXCEL = 36
      CREFTCRYSTALREPORT = 1
      CREFTPORTABLEDOCFORMAT = 31
      CREDTDISKFILE = 1
        CREFTEDITABLERTF = 39
      crAllowPlaceHolders = 2
      crDelayTotalPageCountCalc = 1
      EMFMIMETYPe = "application/x-emf"
      EPFMIMETYPE = "application/x-epf"
      ETFMIMETYPE = "application/x-etf"
'      Initialize Arrays
      gvGroupPath = Array()
      gvGroupLevel = Array()
      gvMaxNode = Array() ' reteive all nodes
      gvTotallerInfo = Array()
      NEWBRCH       = "0"
      sessionError = "An error has occurred."

'  To ensure that the browser does not cache the html pages for the group trees.
Response.Expires = 0
' Parse Query String for paramaters
Call ParseQS()


' If the request is for a image, we do not process the remainder of the page. Rather, we simply return
' the image file.
if      IMAGE <> "" then
      Call session("oEMF").StreamImage(IMAGE, DEL)
      Response.End
end if

' INIT is a special QS case, we only care about HTML viewer, if it is then save send page and branch info
' to the frame page

if INIT = "HTML_FRAME" then
      ' build URL and send the QS
      if BRCH <> ""  and NEWBRCH      = "1" then
            ' htmstart is the base page that creates the frames for the HTML viewer
            ' if there is branch information it needs to be passed along.
                  tmpArray = session("tabArray")
                  if tmpArray(0) <> "EMPTY" then
                        val = UBound(tmpArray, 1) + 1
                        redim preserve tmpArray(val + 4)
                  else
                        val = 0
                  end if
                  tmpArray(val) = CStr(val)
                  tmpArray(val + 1) = session("lastBrch")
                  session("lastBrch") = BRCH
                  tmpArray(val + 2) = session("CurrentPageNumber")
                  tmpArray(val + 3) = session("lastknownpage")
                  tmpArray(val + 4) = session("LastPageNumber")
                  session("tabArray") = tmpArray
            gvURL = "htmstart.asp?brch=" & BRCH & "&"
      else
            if BRCH <> "" then
                  gvURL = "htmstart.asp?brch=" & BRCH
            else
                  gvURL = "htmstart.asp"
            end if
      end if
      response.redirect gvURL
end if


      
' If there is a BRCH then create the gvGroupPath array that represents it.

if BRCH <> "" then
      gvGroupPath = CreateArray(BRCH)
end if

' If there is a GRP then create the gvGroupLevel array that represents it.

if GRP <> "" then
      gvGroupLevel = CreateArray(GRP)
end if

' If there is a TTL_INFO then create the gvTotallerInfo array that represents it.

if TTL_INFO <> "" then
      gvTotallerInfo = CreateArray(TTL_INFO)
end if



' If there are COORDs, then get them
if COORD <> "" then
      Call GetDrillDownCoordinates(COORD, glX, glY)
end if
      
' This case statement determines what action to perform based on CMD
' there are sub cases for each viewer type


            
Select Case CMD

Case "GET_PG"

      Call RetrieveObjects
      
      ' create the actual page
      Set goPage = goPageCollection(PAGE)
      ' check for an exception on the page number
      Call ValidatePageNumber

      ' 0 is for epf, 8209 is a SafeArray
      Select Case VFMT
      
            Case "ENCP"
                  session("oPageEngine").PlaceHolderOptions = 0
                  if(PVERSION > 2)then
                        if INCOMPLETE_PAGE > 0 then
                              session("oPageEngine").PlaceHolderOptions = crAllowPlaceHolders
                        end if
                        if INCOMPLETE_PAGE_COUNT > 0 then
                              session("oPageEngine").PlaceHolderOptions = session("oPageEngine").PlaceHolderOptions + crDelayTotalPageCountCalc
                        end if
                  end if                         
                  session("oPageEngine").ImageOptions = 1
                  temp = goPage.Renderepf(8209)
                  Response.AddHeader "CONTENT-LENGTH", lenb(temp)
                  Response.ContentType = EPFMIMETYPE
                  response.binarywrite temp
            
            Case "HTML_FRAME"
                  session("oPageEngine").ImageOptions = 1
                  response.binarywrite goPage.Renderhtml(1,2,1,request.ServerVariables("SCRIPT_NAME"),8209)
                  ' Need to know if it is the last page to construct the toolbar correctly
                  if goPage.IsLastPage then
                        session("LastPageNumber") = goPage.pagenumber
                        session("CurrentPageNumber") = session("LastPageNumber")
                  end if      
            Case "HTML_PAGE"
                  session("oPageEngine").ImageOptions = 1
                  response.binarywrite goPage.Renderhtml(1,3,3,request.ServerVariables("SCRIPT_NAME"),8209)
            
            end select
      
Case "GET_TTL"
      
      Call RetrieveObjects
      
      Select Case VFMT
      
            Case "ENCP"
                  Response.ContentType = ETFMIMETYPE
                  if(PVERSION > 2)then
                        temp = goPageGenerator.RenderTotallerETF(gvTotallerInfo, 0, 1, gvMaxNode, 8209)
                  else
                        temp = goPageGenerator.RenderTotallerETF(gvGroupPath, 0, 0, gvMaxNode, 8209)
                  end if
                  Response.AddHeader "CONTENT-LENGTH", lenb(temp)
                  response.binarywrite temp
            
            Case "HTML_FRAME"
                  response.binarywrite goPageGenerator.RenderTotallerHTML(gvGroupPath, 1, 0, gvMaxNode, gvGroupLevel, 1, request.ServerVariables("SCRIPT_NAME"), 8209)
            
      end select


Case "RFSH"
      
      ' This command forces the database to be read again.
      session("oRpt").DiscardSavedData
      If Err.Number <> 0 Then
            Call CheckForError
      Else
            session("oRpt").EnableParameterPrompting = False
            session("oRpt").ReadRecords
            Set session("oPageEngine") = session("oRpt").PageEngine
      End If
      Call RetrieveObjects
      Set goPage = goPageCollection(PAGE)
      Call ValidatePageNumber
      session("oPageEngine").ImageOptions = 1
      Select Case VFMT
      Case "ENCP"
      ' Java and Active X Viewers will make a get page command when receiving 0 error msg value
            if VIEWER = "JAVA" then
                  session("oPageEngine").PlaceHolderOptions = 0
                  if(PVERSION > 2)then
                        if INCOMPLETE_PAGE > 0 then
                              session("oPageEngine").PlaceHolderOptions = crAllowPlaceHolders
                        end if
                        if INCOMPLETE_PAGE_COUNT > 0 then
                              session("oPageEngine").PlaceHolderOptions = session("oPageEngine").PlaceHolderOptions + crDelayTotalPageCountCalc
                        end if
                  end if
                  temp = goPage.Renderepf(8209)
                  Response.AddHeader "CONTENT-LENGTH", lenb(temp)
                  Response.ContentType = EPFMIMETYPE
                  response.binarywrite temp
            else
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").SendErrorMsg 0,""
            end if
            
      Case "HTML_FRAME"
            InitializeFrameArray()
            gvURL = "htmstart.asp"
            response.redirect gvURL

      Case "HTML_PAGE"
      session("oPageEngine").ImageOptions = 1
      response.binarywrite goPage.Renderhtml(1,3,1,request.ServerVariables("SCRIPT_NAME"),8209)
            
      end select


Case "NAV"
      Call RetrieveObjects
      Call CheckForError
      ' Get the page number that the group in on, for this particular branch
      gvPageNumber = goPageGenerator.GetPageNumberForGroup(gvGroupLevel)
                  
      Select Case VFMT
      ' 0 is for epf, 8209 is a SafeArray, 8 is a BSTR
      Case "ENCP"
            ' Create a byte array for the EMF, which will contain the page number
            Response.ContentType = EMFMIMETYPE
            session("oEMF").sendpagenumberrecord(gvPageNumber)
      
      Case "HTML_FRAME"
            ' for html browser send back the page
            dim appendQuery
            appendQuery = "?"
            session("CurrentPageNumber") = gvPageNumber
            if BRCH <> "" then
                  appendQuery = appendQuery & "BRCH=" & BRCH & "&"
            end if
            if GRP <> "" then
                        appendQuery = appendQuery & "GRP=" & GRP
            end if
            response.redirect "framepage.asp" & appendQuery
      
      end select


Case "CHRT_DD"
      ' only supported in java and active X smart viewers
      Select Case VFMT

      Case "ENCP"

            '  Get page collection
            Call RetrieveObjects
            Call CheckForError
            ' Pass the coordinates to the report engine to determine what
            ' branch the drill down goes to.
            Set goPageGeneratorDrill = goPageGenerator.DrillOnGraph(PAGE, glX, glY)
            ' Check for an exception because of coordinates
            if err.number <> 0 then
                  gsErrorText = "Not part of the Graph "
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").SendErrorMsg 40, gsErrorText
                  err.clear
                  response.end
            end if
            ' pass the group level and group path to helper function to create
            ' the EMF message, this tells the viewer where to get the page.

            gvGroupPathDD = goPageGeneratorDrill.grouppath
            gvGroupNameDD = goPageGeneratorDrill.groupname
            Response.ContentType = EMFMIMETYPE
            session("oEMF").GroupName = gvGroupNameDD            
            session("oEMF").sendbranchesemf(gvGroupPathDD)            
                  

      end select

Case "GET_LPG"
      
      ' only support in smart viewers
      Select Case VFMT

      Case "ENCP"
            ' this command returns the page number of the last page
            ' Get page collection
            Call RetrieveObjects
            Call CheckForError
            ' Get the count from the Pages collection
            gvPageNumber = goPageCollection.Count

            ' Send the EMF representing the page number
            Response.ContentType = EMFMIMETYPE
            session("oEMF").sendpagenumberrecord(gvPageNumber)
      end select

Case "SRCH"
      Call RetrieveObjects
      Call CheckForError
      ' create page variable
      gvPageNumber = CInt(PAGE)
      
      Select Case VFMT
      Case "ENCP"
            if goPageGenerator.FindText(TEXT, 0, gvPageNumber) then
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").sendpagenumberrecord(gvPageNumber)
            else
                  gsErrorText = "The specified text, '" & TEXT & "' was not found in the report"
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").SendErrorMsg 33, gsErrorText
            end if
                              
      Case "HTML_FRAME"
            ' We are being called by HTML viewer
            ' need to get the text from the form post
            dim searchFound
            TEXT = request.form("text")
            ' Now find out what page the text is on
            tempNumber = gvPageNumber + 1
            If(CBool(goPageGenerator.FindText(TEXT, 0, tempNumber))) then
                  session("CurrentPageNumber") = tempNumber
                  searchFound = 1
            else
                  session("CurrentPageNumber") = gvPageNumber
                  searchFound = 0
            End If
            if BRCH <> "" then
                  gvURL = "framepage.asp?brch=" & BRCH & "&SEARCHFOUND=" & searchFound
            else
                  gvURL = "framepage.asp?SEARCHFOUND=" & searchFound
            end if
            response.redirect gvURL

      Case "HTML_PAGE"
            ' We are being called by HTML viewer
            ' need to get the text from the form post
            TEXT = request.form("text")
            ' Now find out what page the text is on
            tempNumber = gvPageNumber
            If(CBool(goPageGenerator.FindText(TEXT, 0, tempNumber))) then
                  gvPageNumber = tempNumber
                  Set goPage = goPageCollection(gvPageNumber)
                  session("oPageEngine").ImageOptions = 1
                  response.binarywrite goPage.Renderhtml(1,3,3,request.ServerVariables("SCRIPT_NAME"),8209)
            else
            ' Send back an html page indicating the text was not found.
                  Response.Write "<html><title>Seagate ASP Reports Server</title><body bgcolor='white'><center><h1>The text cannot be found in this report.</h1></center></body></html>"
            End If
            
      end select

                        
Case "TOOLBAR_PAGE"
      
      ' Redirect to the framepage, need to know if we are
      ' on the last page.

      if session("LastPageNumber") <> "" then
            if CInt(PAGE) > CInt(session("LastPageNumber")) then
                  session("CurrentPageNumber") = session("LastPageNumber")
            else
                  session("CurrentPageNumber") = PAGE
            end if
      else
            Call RetrieveObjects
            Call CheckForError
            ' create the actual page
            Set goPage = goPageCollection(PAGE)
            ' check for an exception on the page number
            Call ValidatePageNumber
            if goPage.IsLastPage then
                  session("LastPageNumber") = goPage.pagenumber
                  session("CurrentPageNumber") = session("LastPageNumber")      
            else
                  session("CurrentPageNumber") = PAGE
            end if      
      end if
      if BRCH <> "" then
            gvURL = "framepage.asp?brch=" & BRCH
      else
            gvURL = "framepage.asp"
      end if

      response.redirect gvURL

Case "EXPORT"
      Set ExportOptions = Session("oRpt").ExportOptions
      Session("oRpt").DisplayProgressDialog = FALSE
      if(FillExportOptionsObject( EXPORT_FMT)) Then
            Call RetrieveObjects
            response.binarywrite goPageGenerator.Export(8209)
            Call CheckForError
      else
            Response.ContentType = EMFMIMETYPE
            session("oEMF").SendErrorMsg 1, "Invalid Export Type Specified"
      end if

Case "MAP_DD"
      ' only supported in java and active X smart viewers
      Select Case VFMT

      Case "ENCP"

            '  Get page collection
            Call RetrieveObjects
            Call CheckForError
            ' Pass the coordinates to the report engine to determine what
            ' branch the drill down goes to.
            Set goPageGeneratorDrillonMap = goPageGenerator.DrillOnMap(PAGE, glX, glY)
            ' Check for an exception because of coordinates
            if err.number <> 0 then
                  gsErrorText = "No Values Exist for Selected Region of Map"
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").SendErrorMsg 40, gsErrorText            
                  err.clear
                  response.end
            end if
            ' pass the group level and group path to helper function to create
            ' the EMF message, this tells the viewer where to get the page.

            gvGroupPathDD = goPageGeneratorDrillonMap.grouppath
            gvGroupNameDD = goPageGeneratorDrillonMap.groupname
            session("oEMF").GroupName = gvGroupNameDD      
            Response.ContentType = EMFMIMETYPE      
            session("oEMF").sendbranchesemf(gvGroupPathDD)            
                  
      end select

end select



SUB RetrieveObjects()
' This procedure simply retrieves the session objects into global variables.
' In the case of Out of Place Subreports, the SUBRPT parameter must be parsed and the
' Subreport page generator object must be created.
      Dim oRptOptions 'Report Options
      Dim charIndexVal,tmpCharIndexVal
      Dim tmpStr
      Dim tmpPageGenerator
      Dim subPageGenerator
      Dim OOPSSeqNo      'holds the page's OOPS sequence number
      Dim OOPSSubName      'holds the OOPS's name
      Dim subCoords 'holds the coordinates of the OOPS in the main report
      Dim subgvGroupPath 'holds the group path for the main report in subrpt parameter
      Dim mainRptPageNumber 'holds the page number for the main report in the subrpt parameter
      
      subgvGroupPath = Array()
      if IsObject(session("oPageEngine")) then
            ' make sure dialogs have been disabled
            if SUBRPT <> "" Then
            ' Obtain the subreport sequence number
                  charIndexVal = findChar(SUBRPT, ":")
                  if charIndexVal > 1 then
                        OOPSSeqNo = Mid(SUBRPT,1,charIndexVal - 1)
                  end if
            ' Obtain the subreport's name
                  tmpStr = Mid(SUBRPT,charIndexVal + 1)
                  charIndexVal = findChar(tmpStr, ":")
                  if charIndexVal > 1 then
                        OOPSSubName = Mid(tmpStr,1,charIndexVal - 1)
                  end if
                  tmpStr = Mid(tmpStr,charIndexVal + 1)
                  charIndexVal = findChar(tmpStr, ":")
            ' Obtain the group path for the Out of Place Subreport
                  if charIndexVal > 1 then
                        subgvGroupPath = CreateArray(Mid(tmpStr, 1, charIndexVal - 1))
                  end if
            'Obtain the main report page number after the fourth : character
                  tmpStr = Mid(tmpStr,charIndexVal + 1)
            'Get the location of the fourth : seperator
                  charIndexVal = findChar(tmpStr, ":")
                  mainRptPageNumber = Mid(tmpStr, 1, charIndexVal - 1)
            'Get the coordinates portion of the SUBRPT parameter
                  subCoords = Mid(tmpStr, charIndexVal + 1)
                  Call GetDrillDownCoordinates(subCoords, slX, slY)
                  ' Get the main reports page generator for the view
                  Set tmpPageGenerator = session("oPageEngine").CreatePageGenerator(subgvGroupPath)
                  Set subPageGenerator = tmpPageGenerator.DrillOnSubreport(mainRptPageNumber, slX, slY)
                  Set goPageGenerator = subPageGenerator.CreateSubreportPageGenerator(gvGroupPath)
            else
                  Set goPageGenerator = session("oPageEngine").CreatePageGenerator(gvGroupPath)
                  end if
            Set goPageCollection = goPageGenerator.Pages
      else
            ' must have timed out return an error, you may wan to Append to the
            ' IIS log here.
            if VFMT = "ENCP" then
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").SendErrorMsg 1, sessionError
            else
                  response.write sessionError
                  
            end if
            response.end
      end if

END SUB

SUB ParseQS()
      DIM UTF8STR                                                      ' this is the string in UTF-8 format returned from the viewer
      ' Parse the Query String
      CMD = UCase(request.querystring("cmd"))            ' This determines the main function to perform
      PAGE = UCase(request.querystring("page"))      ' the page to return
      BRCH = UCase(request.querystring("BRCH"))      ' the branch is a mechanism to determine the drill down level.
                                                                        ' A drill down level is like a view of the report, a new tab
                                                                        ' is created to indicate that it is a new view
      VIEWER = UCase(request.querystring("VIEWER"))      ' This is the viewer that is calling the server
      VFMT = UCase(request.querystring("VFMT"))      ' the format that the viewer understands
      NODE = UCase(request.querystring("NODE"))
      GRP = UCase(request.querystring("GRP"))            ' this is a way of specifing the actual group
      COORD = UCase(request.querystring("COORD"))      ' these are the coordinates on the graph to process
      DIR = UCase(request.querystring("DIR"))            ' this is the search direction
      CSE = UCase(request.querystring("CASE"))      ' indicates if the search is case sensitive
      UTF8STR = request.querystring("TEXT")            ' this is the text to search for.
      TEXT = session("oEMF").DecodeUTF8String(UTF8STR) ' Convert to Unicode.
      INIT = UCase(request.querystring("INIT"))      ' used to build the frames for the html viewer
      TAB = UCase(request.querystring("TAB"))            ' used to keep track of TABS on drill down.
      EXPORT_FMT = UCase(request.querystring("EXPORT_FMT")) ' Used to specify export format and type.      
      UTF8STR = request.querystring("SUBRPT") ' The Out of Place Subreport coordinates.
      SUBRPT = UCase(session("oEMF").DecodeUTF8String(UTF8STR)) ' Convert to Unicode.
      INCOMPLETE_PAGE = CInt(request.querystring("INCOMPLETE_PAGE"))' Used to specify whether the page is to contain placeholders.
      INCOMPLETE_PAGE_COUNT = CInt(request.querystring("INCOMPLETE_PAGE_COUNT"))' Used to specify whether the page has to contain a total page count.
      PVERSION = CInt(request.querystring("PVERSION"))' Used to indicate the protocol version the viewer is utilizing.
      TTL_INFO = UCase(request.querystring("TTL_INFO"))'Used to indicate the group path of the totaller request.
      IMAGE = UCase(request.querystring("IMAGE"))
      DEL = Cint(request.querystring("DEL"))
      ' Initialize variables to a default if they are not provided on the query string.
      ' Check for Parameter Values that are passed by the HTTP Post Command.
      if CMD = "" then
            CMD = UCase(request.form("cmd"))      
            if CMD = "" then
                  CMD = "GET_PG"
            end if
      end if
      
      if INIT = "" then
            INIT = UCase(request.form("INIT"))
      end if

      if BRCH = "" then
            BRCH = UCase(request.form("BRCH"))
      end if

      if BRCH = "" and INIT = "HTML_FRAME" then
            Call InitializeFrameArray
      end if


      if BRCH <> "" and INIT = "HTML_FRAME"  then
            if session("lastBrch") <> BRCH then
                  NEWBRCH       = "1"
            end if
      end if
                  

      if VIEWER = "" then
            VIEWER = UCase(request.form("VIEWER"))
            if VIEWER = "" then
                  VIEWER = "HTML"
            end if
      end if

      if VFMT = "" then
            VFMT = UCase(request.form("VFMT"))
            if VFMT = "" then
                  VFMT = "HTML_PAGE"
            end if
      end if

      if GRP = "" then
            GRP = UCase(request.form("GRP"))      
      end if

      if TTL_INFO = "" then
            TTL_INFO = UCase(request.form("TTL_INFO"))
      end if

      if COORD = "" then
            COORD = UCase(request.form("COORD"))
      end if

      if NODE = "" then
            NODE = UCase(request.form("NODE"))
      end if

      if DIR = "" then
            DIR = UCase(request.form("DIR"))
            if DIR = "" then
                  DIR = "FOR" ' forward
            end if
      End if

      if CSE = "" then
            CSE = UCase(request.form("CASE"))
            if CSE = "" then
                  CSE = "0" ' case insensitive
            end if
      end if

      if TEXT = "" then
            UTF8STR = request.form("TEXT")
            TEXT = session("oEMF").DecodeUTF8String(UTF8STR) ' Convert to Unicode.
      end if

      if EXPORT_FMT = "" then
            EXPORT_FMT = UCase(request.form("EXPORT_FMT"))
      end if
      
      if SUBRPT = "" then
            UTF8STR = request.form("SUBRPT")
            SUBRPT = UCase(session("oEMF").DecodeUTF8String(UTF8STR)) ' Convert to Unicode.
      end if
      
      if request.form("INCOMPLETE_PAGE") <> "" then
            INCOMPLETE_PAGE = CInt(request.form("INCOMPLETE_PAGE"))
      end if
      
      if request.form("INCOMPLETE_PAGE_COUNT") <> "" then
            INCOMPLETE_PAGE_COUNT = CInt(request.form("INCOMPLETE_PAGE_COUNT"))
      end if
      
      if PVERSION = 0 then
            PVERSION = CInt(request.form("PVERSION"))
      end if
      
      if IMAGE = "" then
            IMAGE = request.form("IMAGE")
      end if
      
      if DEL = 0 then
            DEL = Cint(request.form("DEL"))
      end if
      
' Check to make sure there is a page requested, if not use 1 as a default
      if PAGE = "" then
            PAGE = UCase(request.form("page"))
            if PAGE = "" then
                  PAGE = "1"
            end if
      end if
      
      if PAGE <> "" and NOT IsNumeric(PAGE) then
            PAGE = "1"
      end if
      
END SUB

Function CreateArray(ByVal vsStringArray)
' this function takes an string like 0-1-1-0 and converts
' it into an array of integers

    Dim lvArray
    Dim lvNewArray
    Dim liCount
    Dim liCurrentPos
    Dim lsBuf
    lvArray = Array()
    lvNewArray = Array()
    ReDim lvArray(256)
   
    liStringLength = Len(vsStringArray)
    liCount = 0
    liCurrentPos = 1
    lsBuf = ""
   
    While liCurrentPos <= liStringLength
         
         'ignore this character
        If Mid(vsStringArray, liCurrentPos, 1) <> "-" Then
            lsBuf = lsBuf & Mid(vsStringArray, liCurrentPos, 1)
            If liCurrentPos = liStringLength Then
                lvArray(liCount) = CInt(lsBuf)
                lsBuf = ""
                liCount = liCount + 1
            End If
           
        Else
            lvArray(liCount) = CInt(lsBuf)
            lsBuf = ""
            liCount = liCount + 1
        End If
        liCurrentPos = liCurrentPos + 1
    Wend
   
    ReDim lvNewArray(liCount - 1)
   
    For x = 0 To (liCount - 1)
        lvNewArray(x) = lvArray(x)
    Next
   
   
    CreateArray = lvNewArray

End Function

' Helper function to parse coordinates passed by viewers and place into independent variables.
SUB GetDrillDownCoordinates(ByVal strParam, ByRef xCoord, ByRef yCoord)
      Dim liStringLength
      Dim lbDone
      Dim lsBuf

      liStringLength = Len(strParam)
      lbDone = FALSE
      lsBuf = ""
      xCoord = ""
      yCoord = ""
      For x = 1 To liStringLength
            lsBuf = Mid(strParam, x, 1)
            
            'ignore this character
            If lsBuf = "-" Then
                  lsBuf = ""
                  lbDone = TRUE
            End if
            
            if lbDone then
                  yCoord = yCoord + lsBuf
            else
                  xCoord = xCoord + lsBuf
            end if
                  
      Next
      
END SUB

' This helper procedure will check if the requested page number exists.
' If it does not, it will set it to the last available page.
SUB ValidatePageNumber()
      if err.number <> 0 then
            if err.number = 9 or err.number = -2147352565 then
                  ' just return the last page
                  PAGE = goPageCollection.count
                  Set goPage = goPageCollection(PAGE)
                  ' these session variables are used for the HTML Frame viewer
                  session("LastPageNumber") = PAGE
                  session("CurrentPageNumber") = PAGE
                  err.clear
            else
                  ' A more serious error has occurred. Error message sent to browser.
                  Call CheckForError
            end if
      end if
END SUB



'  This helper procedure will send an error msg to the browser based on what viewer is being used.
SUB CheckForError()
      If Err.Number <> 0 Then
            if VFMT = "ENCP" then
                  Response.ContentType = EMFMIMETYPE
                  session("oEMF").SendErrorMsg 1, "CRAXDRT Error Occured on Server. " & Err.Number  & " : " & Err.Description
            else
                  Response.Write "CRAXDRT Error Occured on Server. Error Number: " & Err.Number & " Error Description: " & Err.Description
            end if
            Response.end
      End if
END SUB

SUB InitializeFrameArray()
'initialize the html_frame array
      set session("tabArray") = Nothing
      session("lastBrch") = ""
      dim tmpArray
      tmpArray = Array(4)
      redim tmpArray(4)
      'Initialize the sequence number
      tmpArray(0) = "EMPTY"
      session("tabArray") = tmpArray
END SUB

' Helper function to parse the EXPORT_FMT parameter and fill in the properties of the
' Export object.
FUNCTION FillExportOptionsObject(export_fmt_options)
      dim charIndex
      dim exportType
      dim exportDLLName
      charIndex = findChar(export_fmt_options,":")
      'Set session("ExportOptions") = Session("oRpt").ExportOptions
      if(charIndex > 0) Then
      'Get the export format type value
            exportType = Mid(export_fmt_options, charIndex + 1)
            exportDLLName = UCase(Mid(export_fmt_options, 1, charIndex - 1))
            Select Case exportDLLName
                  Case "CRXF_WORDW"            
                        ExportOptions.FormatType = CREFTWORDFORWINDOWS
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.WordWExportAllPages = False
                              ExportOptions.WordWFirstPageNumber = startPage
                              ExportOptions.WordWLastPageNumber = endPage
                        Else
                              ExportOptions.WordWExportAllPages = True
                        End If
                        Response.ContentType = "application/msword"
                  Case "U2FWORDW"
                        ExportOptions.FormatType = CREFTWORDFORWINDOWS
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.WordWExportAllPages = False
                              ExportOptions.WordWFirstPageNumber = startPage
                              ExportOptions.WordWLastPageNumber = endPage
                        Else
                              ExportOptions.RTFExportAllPages = True
                        End If
                        Response.ContentType = "application/msword"
                  Case "CRXF_RTF"      
                                If CInt(exportType) = 0 Then
                          ExportOptions.FormatType = CREFTRICHTEXT
                        Else
                          ExportOptions.FormatType = CREFTEDITABLERTF
                        End If
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.RTFExportAllPages = False
                              ExportOptions.RTFFirstPageNumber = startPage
                              ExportOptions.RTFLastPageNumber = endPage
                        Else
                              ExportOptions.RTFExportAllPages = True
                        End If      
                        Response.ContentType = "application/rtf"
                  Case "U2FRTF"
                                If CInt(exportType) = 0 Then
                          ExportOptions.FormatType = CREFTRICHTEXT
                        Else
                          ExportOptions.FormatType = CREFTEDITABLERTF
                        End If
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.RTFExportAllPages = False
                              ExportOptions.RTFFirstPageNumber = startPage
                              ExportOptions.RTFLastPageNumber = endPage
                        Else
                              ExportOptions.RTFExportAllPages = True
                        End If            
                        Response.ContentType = "application/rtf"
                  Case "CRXF_XLS"
                        If CInt(exportType) = 10 Then
                          ExportOptions.FormatType = CREFTEXCELDATAONLY
                        Else
                          ExportOptions.FormatType = CREFTEXCEL
                        End If
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.ExcelExportAllPages = False
                              ExportOptions.ExcelFirstPageNumber = startPage
                              ExportOptions.ExcelLastPageNumber = endPage
                        Else
                              ExportOptions.RTFExportAllPages = True
                        End If      
                        Response.ContentType = "application/vnd.ms-excel"
                  Case "U2FXLS"
                        If CInt(exportType) = 10 Then
                          ExportOptions.FormatType = CREFTEXCELDATAONLY
                        Else
                          ExportOptions.FormatType = CREFTEXCEL
                        End If
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.ExcelExportAllPages = False
                              ExportOptions.ExcelFirstPageNumber = startPage
                              ExportOptions.ExcelLastPageNumber = endPage
                        Else
                              ExportOptions.RTFExportAllPages = True
                        End If
                        Response.ContentType = "application/vnd.ms-excel"
                  Case "U2FCR"
                        ExportOptions.FormatType = CREFTCRYSTALREPORT
                        Response.ContentType = "application/x-rpt"
                  Case "CRXF_PDF"                  
                        ExportOptions.FormatType = CREFTPORTABLEDOCFORMAT
                        ExportOptions.PDFExportAllPages = TRUE
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.PDFExportAllPages = False
                              ExportOptions.PDFFirstPageNumber = startPage
                              ExportOptions.PDFLastPageNumber = endPage
                        Else
                              ExportOptions.PDFExportAllPages = True
                        End If
                        Response.ContentType = "application/pdf"
                  Case "U2FPDF"
                        ExportOptions.FormatType = CREFTPORTABLEDOCFORMAT
                        GetExportPageRange startPage, endPage
                        If startPage > 0 Then
                              ExportOptions.PDFExportAllPages = False
                              ExportOptions.PDFFirstPageNumber = startPage
                              ExportOptions.PDFLastPageNumber = endPage
                        Else
                              ExportOptions.PDFExportAllPages = True
                        End If
                        Response.ContentType = "application/pdf"
                  Case Else
                        FillExportOptionsObject = False
                        Exit Function
            End Select
            ExportOptions.DestinationType = CREDTDISKFILE
            FillExportOptionsObject = True
      else
            FillExportOptionsObject = False
      end if

end FUNCTION

'Helper function to get page range for exports.

Sub GetExportPageRange(ByRef startPage, ByRef endPage)
      Dim exportOptions
      exportOptions = Request.QueryString("export_opt")

      startPage = 0
      endPage = 0

      If exportOptions = "" Then
            Exit Sub
      End If

      'The export_opt value is formatted as follows:
      '[n-m]  page n to m
      '(-n]   first page to n
      '[n-)      page n to the end
      '(-)    all pages

      Dim i, dashIndex
      dashIndex = findChar(exportOptions, "-")
      If      dashIndex = -1 Then
            Exit Sub
      End If

      'Check for a starting page
      i = findChar(exportOptions, "[")
      If i <> -1 Then
            startPage = Mid(exportOptions, i + 1, dashIndex - i - 1)
      Else
            startPage = 1
      End If

      'Check for an ending page
      i = findChar(exportOptions, "]")
      If i <> -1 Then
            endPage = Mid(exportOptions, dashIndex + 1, i - dashIndex - 1)
      Else
            endPage = -1
      End If
End Sub

             
'  Helper function that returns the index of the character in the given string.
Function findChar(findStr, charToFind)
      dim lenStr
      dim result
      lenStr = len(findStr)
      result = -1
      if(lenStr > 0) Then
            charCounter = 1
            do While(charCounter <= lenStr)
                  tmpChar = Mid(findStr,charCounter,1)
                  if(tmpChar = charToFind) Then
                        result = charCounter
                        Exit Do
                  end if
                  charCounter = charCounter + 1
            loop
      end if
      
      findChar = result
End Function      

%>


0
 

Author Comment

by:SenthilKavitha
ID: 20384617
I resolved this issue, this is because of the Security settings on ActiveXViewer.cab on web server.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 20592591
PAQed with points refunded (125)

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now