.NETGURU
Crystal report export to pdf file (asp.net)
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-crystal' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

akega pirom
Can someone help me? I'm using crystal report which is
built in asp.net. i'm using "vb" code. my requirement
is to export a crystal report to pdf format and can
specify destination file to stroage when click button
OK.
if someone knows please mail to me

Click here to reveal e-mail address

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

Reply to this message...
 
    
Eric Landes (VIP)
Here is an older email from the brilliant Mac Kloberg that explains how =
to
do this. This used Beta 2 software, so there may be a few changes.

HTH

*************************=20
Eric Landes=20
Senior Programmer/Analyst member of the ASPFriends.com Moderator team=20
For Articles on Crystal.Net, Datagrids and more check out
http://www.aspalliance.com/corporatecoder/
*************************=20
All statements expressed are my own, and do not reflect the opinion of =
my
employer, unless stated otherwise.=20

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Jim,
as far as I know, the webviewer doesn't support exporting directly, so =
you
have to do do this yourself. I haven't found a way yet to do this
"in-memory", so the following example uses a temporary file (using the
session id as the filename). It sends the report to the client as a PDF
file, but you can easily change it to export in different formats:

Dim TargetFildName as String
Dim fs As FileStream
Dim FileSize As Long
Dim GenDS As DataSet
Dim oRD As New ReportDocument()
Dim crReportObject As =
CrystalDecisions.CrystalReports.Engine.ReportObject
Dim oExO As ExportOptions
Dim oExDo As New DiskFileDestinationOptions()

'Build Target Filename
TargetFileName =3D Server.MapPath("/") & "\Export\" & Session.SessionID =
&
".pdf"

'Load report
oRD.Load(Server.MapPath("/") & "\Reports\MyReport.rpt")

'Set Report Datasource
oRD.SetDataSource(GenDS)

'Export to PDF
oExDo.DiskFileName =3D TargetFileName
oExO =3D oRD.ExportOptions
oExO.ExportDestinationType =3D ExportDestinationType.DiskFile
oExO.ExportFormatType =3D ExportFormatType.PortableDocFormat
oExO.DestinationOptions =3D oExDo
oRD.Export()
oRD.Close()

'Send the file to the user that made the request
Response.Clear()
Response.Buffer =3D True
Response.AddHeader("Content-Type", "application/pdf")
Response.AddHeader("Content-Disposition", "attachment;
filename=3DMyReport.pdf;")
fs =3D New FileStream(TargetFileName, FileMode.Open)
FileSize =3D fs.Length
Dim bBuffer(CInt(FileSize)) As Byte
fs.Read(bBuffer, 0, CInt(FileSize))
fs.Close()

Response.BinaryWrite(bBuffer)
Response.Flush()
Response.Close()

hth
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-----Original Message-----
From: akega pirom [mailto:Click here to reveal e-mail address]
Sent: Thursday, July 18, 2002 5:49 AM
To: ngfx-crystal
Subject: [ngfx-crystal] Crystal report export to pdf file (asp.net)

Can someone help me? I'm using crystal report which is
built in asp.net. i'm using "vb" code. my requirement=20
is to export a crystal report to pdf format and can
specify destination file to stroage when click button
OK.
if someone knows please mail to me=20
=20
Click here to reveal e-mail address

Confidentiality Notice: This e-mail message, including any
attachments, is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.

PARTNERS Health Plan Phone: 574-233-4899
100 E. Wayne St., Suite 502 Fax: 574-234-7484
South Bend, IN 46601 www.partnersindiana.com

Reply to this message...
 
 
System.Data.DataSet
System.IO.FileMode
System.IO.FileStream




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification