答案:'rptserver.asp
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
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)
上一个:ASP Call Crystal Report with Store Procedure(7)
下一个:ASP Call Crystal Report with Store Procedure(5)