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
its Minimize the Report Designing Efforts
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.
Did you learn anything interesting/fun/annoying while writing the code? Did you do anything particularly clever or wild or zany?
Keep a running update of any changes or improvements you've made here.
| You must Sign In to use this message board. | ||||||
|
||||||
|
||||||
|
||||||