web crystal report in pdf format

G

Guest

Hi,

I built a web form to display a crystal report in web, every thing work
properly. I added then a button to display the report in the embedded adobe
reader by using the below codes:

Dim oStream As New MemoryStream
oStream =
crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/msword"
Response.BinaryWrite(oStream.ToArray())
Response.End()

It works as well. Then I supressed the button and called above codes at the
last time of form load, but the browser returned me some strange codes
instead of the pdf report. Is there a way to display the report directly in
adobe reader?

I appreciate for any helps
 
C

Chris Huddle

Li - Try setting the ContentType property to "application/pdf" and set the
ExportFormatType property to "PortableDocFormat."
 
G

Guest

hi,

I try to do the same thing as you mentionned but I ma one step backwards
I am not able to display report data on a web form

How do you do this, do you have a sample ?

Do you use the embeded Crystal file to framework or did you installed the
full developper version ?

thanks for your hlep
regards
 
G

Guest

Hi
It looks like you are using MS word export format and not pdf

Response.ContentType = "application/pdf"
ExportFormatType.PortableDocFormat
 
G

Guest

If you still want to show word file, use following code:

Response.ContentType = "octet/stream";
Response.AddHeader("Content-Disposition", "attachment;filename=filename");

HTH
 
G

Guest

Hi,

Thanks for all. I'm sorry that there is a mistake in my codes, I did use
Response.ContentType = "application/pdf"
and not
Response.ContentType = "application/msword"

otherwise I could get Adobe working. My issue is to display the report in
adobe directly but not by clicking a button with a codes given.

serge calderara,
please refer to the book
"Professional Crystal Reports for Visual Studio .NET"
 
C

Christopher Reed

I'm not sure if you can do this in the Page_Load. Try putting your code in
the Page_Render method instead.
 
G

Guest

Since you export CR to word format, you can’t open it by adobe
Reader, even if you use
Response.ContentType = "application/pdf".
adobe Reader will recognize it is not pdf file.

HTH

Elton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top