Skip to main content
Email Password   helpLost your password?

Introduction

This Line of Code Just Print Your Document in PDf File Dirtecly with out using Crystal Report view Just Pass SP Name and Parameter to this Method and its Dynamically Create File on Remote Server

Background

its Minimize the Report Designing Efforts

Using the code

A brief description of how to use the article or code. The class names, the methods and properties, any tricks or tips.

string strTemp; string DirPath; string strExportFile; CrystalDecisions.Shared.ExportOptions ExpOptions; CrystalDecisions.Shared.DiskFileDestinationOptions FileDesOption; CrystalDecisions.Shared.TableLogOnInfo ConInfo = new CrystalDecisions.Shared.TableLogOnInfo(); CrystalDecisions.Shared.ParameterDiscreteValue paraValue = new CrystalDecisions.Shared.ParameterDiscreteValue(); objReport = new CrystalDecisions.CrystalReports.Engine.ReportDocum ent(); objReport.Load( Server.MapPath( "Reports\\" + reportName + "rpt" ) ); objReport.SetDatabaseLogon( objLetterUtility.userID, objLetterUtility.passWord ); if( is_SupportUser.Equals( "0" ) ) objReport.SetParameterValue( 0, _Code ); else { objReport.SetParameterValue( 0, _Code ); objReport.SetParameterValue( 1, "True" ); } DirPath = Server.MapPath( "Temp" ); strTemp = reportName + "pdf"; strExportFile = DirPath + "\\" + strTemp; FileDesOption = new CrystalDecisions.Shared.DiskFileDestinationOptions (); FileDesOption.DiskFileName = strExportFile; ExpOptions = (CrystalDecisions.Shared.ExportOptions) objReport.ExportOptions; ExpOptions.DestinationOptions = FileDesOption; ExpOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.Disk File; ExpOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableD ocFormat; objReport.Export( ExpOptions ); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.WriteFile( strExportFile ); Response.Flush(); Response.Close(); } catch( Exception ex ) { throw ex; }

Use the "var" button to to wrap Variable or class names in <code> tags like this.

Points of Interest

Did you learn anything interesting/fun/annoying while writing the code? Did you do anything particularly clever or wild or zany?

History

Keep a running update of any changes or improvements you've made here.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
Generaldo you have any problems with formatting ? Pin
toxcct
0:59 21 Mar '08  


Last Updated 21 Mar 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009