Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2005, 06:43 PM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing crystal reports from asp.net

First off I know this topic has many posts and replies...none of them apply to me. My situation is this: I have an asp.net web site that generates crystal reports using stored procedures...this all works fine. I bought the book "Professional Crystal Reports for visual studio.net" by David Mcamis...followd the example on page 185 about exporting to pdf then printing...doesnt work in my application. I then downloaded the example code from this site and ran it...doesnt work, the error I receive is "Invalid File Name" the code trips on MyReport.export() in both applications...frustrating. I believe all permissions have been set correctly for ASP.NET, Admins, Users etc...I'm at a loss please help me. Im so close to getting this F%$&(ng project complete its insane

 
Old January 20th, 2005, 12:30 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Code:
string strFileName = "Test.pdf";
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath(@"CRPDF.rpt"));
DataSet TestDataSetPDF = GetDataSet(userName());
rptDoc.SetDataSource(TestDataSetPDF);
rptDoc.SetDatabaseLogon("sa","sa123");

ExportOptions exportOpts = new ExportOptions();
PdfRtfWordFormatOptions pdfopts = new PdfRtfWordFormatOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = rptDoc.ExportOptions;
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
exportOpts.FormatOptions =  pdfopts;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = Server.MapPath(strFileName);
exportOpts.DestinationOptions = diskOpts;
rptDoc.Export ();
Response.Redirect (strFileName);
This is how i create a PDF file and show it on the browser. Hmm i haven't tried printing it on the fly without showing the PDF to the user.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 1.1,VB.NET,crystal reports, SQl server gvi Crystal Reports 1 September 11th, 2008 02:55 AM
Printing Crystal report thro' ASp.Net monika.vasvani ASP.NET 1.0 and 1.1 Professional 0 September 13th, 2006 05:59 AM
ASP.NET using Crytsal Reports printing nightmare badgolfer ASP.NET 1.0 and 1.1 Basics 0 October 25th, 2004 07:58 AM
Using Crystal Reports in ASP.NET jbenson001 ASP.NET 1.x and 2.0 Application Design 2 November 18th, 2003 10:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.