Results 1 to 2 of 2

Thread: generate PDF report automatically

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    generate PDF report automatically

    Hi all.

    I want to know how to auto create report in PDF format.
    For instance, at the end of each month, I want the report to be automatically generated. I hope someone who knows or have experience in solving this problem, could guide me or give me some references or give me code examples related to this problem.

    FYI, I use ASP for coding and Access as a database.

    Thanks in advance.

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    Re: generate PDF report automatically

    HTML Code:
    if you are using C#
    
    Report3bueno Rep = new Report3bueno(); 			
    			
    CrystalDecisions.Shared.TableLogOnInfo tliCurrent;
    foreach(CrystalDecisions.CrystalReports.Engine.Table tbCurrent in Rep.Database.Tables)
      {
    	tliCurrent = tbCurrent.LogOnInfo;				
    	tliCurrent.ConnectionInfo.ServerName = your servername
    	tliCurrent.ConnectionInfo.UserID = userid";
    	tliCurrent.ConnectionInfo.Password = pwd;
    	tliCurrent.ConnectionInfo.DatabaseName = "reportes";
    	tbCurrent.ApplyLogOnInfo(tliCurrent);
      }
    	CrystalReportViewer1.ReportSource = Rep;			
    	MemoryStream oStream;
            oStream = (MemoryStream)Rep.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
    	Response.Clear();
    	Response.Buffer= true;
    	Response.ContentType = "application/pdf"; 
    	Response.BinaryWrite(oStream.ToArray());
    	Response.End(); 
    
    
    if you are using vb
       Me.CrystalReportViewer1.ReportSource = crReporte
       Me.CrystalReportViewer1.Visible = True
       '-----------------------------------------------------
       'Report Export
       '-----------------------------------------------------
       Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
       crReporte.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
       crReporte.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
    
       Dim req As New ExportRequestContext
       Dim s As System.IO.Stream
    
       req.ExportInfo = crReporte.ExportOptions
       s = crReporte.FormatEngine.ExportToStream(req)
    
       Response.ClearHeaders()
       Response.ClearContent()
       Response.ContentType = "application/pdf"
    
       Dim buffer(s.Length) As Byte
       s.Read(buffer, 0, Int(s.Length))
       Response.BinaryWrite(buffer)
       Response.End()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width