|
-
May 7th, 2006, 09:37 PM
#1
Thread Starter
Lively Member
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.
-
May 8th, 2006, 08:11 AM
#2
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|