Solved

crystal reports to show in PDF format

Posted on 2007-12-06
6
1,050 Views
Last Modified: 2013-11-26
Hi,
How to show crystal reports in pdf .
i am using crystal report viewer to show the reports now.
here is my code ,which i am using now.

using crystal reports 9/.net 1.1/c#
Thank you
public CrystalReport1 rpt = new CrystalReport1();
 

private void Page_Load(object sender, System.EventArgs e)

{

sqlDataAdapter1.Fill(dataSet11,"produ");

CrystalReportViewer1.ReportSource = rpt;

rpt.SetDataSource(dataSet11);

}

Open in new window

0
Comment
Question by:tag_k
6 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 20421408
0
 
LVL 4

Expert Comment

by:habibb
ID: 20426942
you can use following code to show report to pdf formate instead of in viewer.

Dim CR as New  ReportDocument
..
..' provide path to open the report and enter parameters here too.

With CrExportOptions
        ' Set the destination to a disk file
      .ExportDestinationType = ExportDestinationType.DiskFile
      ' Set the format to PDF
      .ExportFormatType = ExportFormatType.PortableDocFormat
      ' Set the destination options to DiskFileDestinationOptions object
      .DestinationOptions = CrDiskFileDestinationOptions
      .FormatOptions = CrFormatTypeOptions
End With
' Export the report to the PDF folder path
CR.Export()

can use this code in click event of button control
0
 
LVL 4

Expert Comment

by:stcindia
ID: 20433163
Codes attached for ASP.NET (VB) pasted from my live project, this should help solve your problem.

Dim mem As MemoryStream

mem = rpt.ExportToStream(ExportFormatType.PortableDocFormat)

Response.Clear()

Response.Buffer = True

Response.ContentType = "application/pdf"

Response.BinaryWrite(mem.ToArray)

Response.End()

Open in new window

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:tag_k
ID: 20437496
Thanks everyone but anyone can code it in c#/asp.net 1.1

thanks
0
 
LVL 4

Accepted Solution

by:
stcindia earned 500 total points
ID: 20440501
Try using this and revert.
public CrystalReport1 rpt = new CrystalReport1();

 

private void Page_Load(object sender, System.EventArgs e)

{

sqlDataAdapter1.Fill(dataSet11,"produ");

CrystalReportViewer1.ReportSource = rpt;

rpt.SetDataSource(dataSet11);

        MemoryStream mem;

        mem= (MemoryStream) rpt.ExportToStream(ExportFormatType.PortableDocFormat);

        Response.Clear();

        Response.Buffer = true;

        Response.ContentType = "application/pdf";

        Response.BinaryWrite(mem.ToArray());

        Response.End();

}

Open in new window

0
 

Author Comment

by:tag_k
ID: 20442544
Thanks StcIndia,
Just changed as below and working fine.
mem= (MemoryStream) rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

930 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

10 Experts available now in Live!

Get 1:1 Help Now