For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > January 2006 > Export report thr ASP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Export report thr ASP
Jason Chan

2005-04-19, 4:01 am

Please point me to the right newsgroup if i'm in a wrong place to ask this
question.

I uses Crystal Report 9 and tried the asp sample code from Crystal to export
the report to doc directly to the web broswer.

However it give me 404 error. The first thing i thought is permission
problem so I give full control permisson to Everyone on the exporting
folder, but it keep giving the 404 error

So I change one line of codes hope it can give me a more meaningful error.
I changed
Session("oRpt").Export False
to
Session("oRpt").Export True

Now it gives

Active Server Pages error 'ASP 0115'
Unexpected error
/CRSample/SimpleReportExport/SimpleReportExport.asp
A trappable error (E06D7363) occurred in an external object. The script
cannot continue running.


Here is the full code of script

<%@ LANGUAGE="VBSCRIPT" %>

<%
'=======================================
================================
' WORKING WITH THE REPORT DESIGNER COMPONENT AND ASP TO EXPORT A REPORT
'=======================================
================================
'
' CONCEPT
'
' ALWAYS REQUIRED STEPS (contained in AlwaysRequiredSteps.asp)
' - create the application object
' - create the report object
' - open the report
'
' EXPORTING A REPORT
' - set a variable to reference the ExportOptions Object of the report
' - set the ExportOptions for the report including the export destination
and export type
' - redirect the user to the newly exported file so they are prompted to
download or view
' the file
'
' MORE ALWAYS REQUIRED STEPS (contained in MoreRequiredSteps.asp)
' - retreive the records
' - create the page engine
'
' DISPLAY THE REPORT
' - display the report using a smart viewer
'=======================================
===========================
%>

<%
' This line creates a string variable called reportname that we will use to
pass
' the Crystal Report filename (.rpt file) to the OpenReport method contained
in
' the AlwaysRequiredSteps.asp.

reportname = "SimpleReportExport.rpt"
%>

<%
'=======================================
===========================
' ALWAYS REQUIRED STEPS
'
' Include the file AlwaysRequiredSteps.asp which contains the code
' for steps:
' - create the application object
' - create the report object
' - open the report
'=======================================
===========================
%>
<!-- #include file="AlwaysRequiredSteps.asp" -->

<%
'=======================================
===========================
' EXPORTING A REPORT
'=======================================
===========================

Set CrystalExportOptions = Session("oRpt").ExportOptions
'This line of code set a variable to reference the ExportOptions Object.

'The variables below (ExportFileName, ExportDirectory,
ReportCacheVirtualDirectory,
'and ExportType) are used as follows:
' - ExportFileName is the actual file name that should be created by the
export process
' - ExportDirectory is the physical directory where the ExportFileName will
be placed
' - ExportType is a number that specifies the type of file that the export
process should
' create. For a list of these numbers, please refer to the Crystal
Reports Report Design Component
' help file (crrdc.hlp) in the "ExportOptions Object for the Object
Model" section. Scroll down to
' the ExportType property. To change the type of file that the export
process should be creating, change
' the value in the ExportType variable, and change the last portion of
the ExportFileName
' variable. The example here exports a .doc file, which is a Word file,
which is the
' ExportType "14".
'
' Some export types have other properties in the ExportOptions object
that require values
' to be set. For example exporting to HTML. This type will require that
you will also
' set the HTMLFileName property. For detailed information on which
properties to set,
' refer to the "ExportOptions Object" topic in the help file (crrdc.hlp)


ExportFileName = "ExportedReport.doc"

Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
'The While/Wend loop is used to determine the physical location
'of the SimpleReportExport.asp so that we can save the
'ExportedReport.doc in the same location.

ExportDirectory = Path
ExportType = "14"

CrystalExportOptions.DiskFileName = ExportDirectory & ExportFileName
'This line of code specifies the physical location and file name to give
'the export result.

CrystalExportOptions.FormatType = CInt(ExportType)
'This line of code specifies the export format (in this case MS Word).

CrystalExportOptions.DestinationType = CInt(1)
'This line of code specifies that the export destinatin is to be disk.

Session("oRpt").Export True
'This line of code turns of any prompting when exporting.

Response.Redirect ("ExportedReport.doc")
'This line of code redirects the URL to the newly exported file.
'It is important to remember that the exporting is taking place on the web
server
'so we need to redirect the user to the newly exported file or they will
never
'have access to that file.
%>


TravisWonder

2006-01-27, 7:35 pm

Has anyone come up with a response to this? I am seeing the same thing. But to add insult to injury. I have been running simple CR reports this way just fine. I added a couple of much more complex reports and they do not work. Now here's the real twisted part. *occasionally* if I run one of the simple reports first, then the complex report will run. But if I run the complex report first it will always crash with this ASP Error:

Active Server Pages error 'ASP 0115'

Unexpected error

/ETIS/reports/ReportEngine.asp

A trappable error (E06D7363) occurred in an external object. The script cannot continue running

Any help will be greatly appreciated!!!

Even if it's just a "try this".
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com