Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Exporting Crystal Reports to PDF using ASP.NET

Author  Topic 

Gyto
Posting Yak Master

144 Posts

Posted - 2006-10-26 : 10:30:19
Hi there,

I have created a crystal report in Visual Studio 2005 which retrieves it's information from an SQL Server 2000 Table. VS has automatically generated the following ASP.NET page to display the report for me:



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="CostDetailsReport.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="CR" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Cost Details</title>
</head>
<body>

<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" Runat="server" AutoDataBind="True"
Height="947px" ReportSourceID="CrystalReportSource1" Width="845px" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="CostDetailsReport.rpt">
</Report>

</CR:CrystalReportSource>

</div>

</form>
</body>
</html>


Here's the issue:

Instead of loading and displaying the report inside the Crystal Report Viewer of a browser window, I would like to export it straight into a PDF document and display that instead. I have seen a few code examples but I am not particularly familier with ASP.NET so I don't know how to implement them inside the page. Could anyone suggest a way of doing this? Or maybe even some code?

Thanks in advance for any help! =S
   

- Advertisement -