Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combine two Reports into one Report Document

Status
Not open for further replies.

cmcleod

Programmer
Sep 18, 2001
15
US
Anyone ever combined two Crystal Reports into one CrystalDecisions.CrystalReports.Engine.ReportDocument and streamed that combination out to a browser?

*WORKS ****************************************************************
Dim rpt1 As New CrystalReport1

Dim rpt As New ReportDocument
rpt.Load(Server.MapPath(rpt1.ResourceName))
rpt.SetDataSource(ds)

Dim crExportOptions As ExportOptions
crExportOptions = rpt.ExportOptions

With crExportOptions
.FormatOptions = New PdfRtfWordFormatOptions
.ExportFormatType = ExportFormatType.PortableDocFormat
End With

Dim req As ExportRequestContext = New ExportRequestContext
req.ExportInfo = crExportOptions

Dim st As System.IO.Stream
st = rpt.FormatEngine.ExportToStream(req)
Response.ContentType = "application/pdf"
Dim b(st.Length) As Byte
st.Read(b, 0, st.Length)
Response.BinaryWrite(b)
***********************************************************************


*DOESN'T WORK *********************************************************
Dim rpt1 As New CrystalReport1
Dim rpt2 As New CrystalReport2

Dim rpt As New ReportDocument
rpt.Load(Server.MapPath(rpt1.ResourceName))
rpt.Load(Server.MapPath(rpt2.ResourceName))

rpt.SetDataSource(ds)

Dim crExportOptions As ExportOptions
crExportOptions = rpt.ExportOptions

With crExportOptions
.FormatOptions = New PdfRtfWordFormatOptions
.ExportFormatType = ExportFormatType.PortableDocFormat
End With

Dim req As ExportRequestContext = New ExportRequestContext
req.ExportInfo = crExportOptions

Dim st As System.IO.Stream
st = rpt.FormatEngine.ExportToStream(req)
Response.ContentType = "application/pdf"
Dim b(st.Length) As Byte
st.Read(b, 0, st.Length)
Response.BinaryWrite(b)
***********************************************************************
 
Don't know if that's possible, but you might use a subreport for one of the reports (or even for both with a blank Main report).

--k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top