Skip to main content

Posts

Showing posts with the label Crystal Report

Code to export crystal report to pdf directly

Code to export crystal report to pdf directly //Declare Reportdocument Object ReportDocument rpt=new ReportDocument(); //set a ReportPath and assign the dataset to reportdocument object rpt.Load(Server.MapPath("Report1.rpt")); rpt.SetDataSource(ds); //assign the values to crystal report viewer CrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); //Exporting PDF MemoryStream oStream; // using System.IO oStream = (MemoryStream) rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.BinaryWrite(oStream.ToArray()); Response.End();

Common crystal report code for asp.net program

Imports System.Data.SqlClient Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports System.data Public Class CrysReport ‘Variables Declaration Private obj As New Class1 Dim crParameterDiscreteValue As ParameterDiscreteValue Dim crconnectionInfo As New ConnectionInfo Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldLocation As ParameterFieldDefinition Dim thisFormulaField As CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition Dim crParameterValues As ParameterValues Dim crtableLogoninfos As New TableLogOnInfos() Dim crtableLogoninfo As New TableLogOnInfo() Dim CrTables As Tables Dim CrTable As Table ‘This function is to shows value through formula text Public Sub report_date_formula(ByVal crReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal from_date As String, ByVal to_date As String) Try For Each thisFormulaField In crRep...

Code help with example of crystal Reports

Export Crystal Report to Excel Sheet MemoryStream oStream; // using System.IO oStream = (MemoryStream) rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel); Response.Clear(); Response.Buffer = true; Response.ContentType = "appliaction/ms-excel"; Response.BinaryWrite(oStream.ToArray()); Response.End() Export Crystal Report to Excel ReportDocument rpt=new ReportDocument();//set a ReportPath and assign the dataset to reportdocument objectrpt.Load(Server.MapPath("Report1.rpt")); rpt.SetDataSource(ds); //assign the values to crystal report viewerCrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); //Exporting PDFMemoryStream oStream; // using System.IOoStream = (MemoryStream)rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true;Response.ContentType = "application/pdf"; Response.BinaryWrite(oStream.To...