The following guidelines show how to use ActiveReports 2.0 under the .NET framework.
Option Explicit Public Function PDFExport() As Byte() Dim ar As New Rpt Dim exp As New ActiveReportsPDFExport.ARExportPDF Dim st As Variant ar.Run False exp.ExportStream ar.Pages, st PDFExport = st End Function
To install this COM component on your Visual Studio .NET computer:
regsvr32 c:\ AR_Provider\AR_Provider.dll
Next, use the tlbimp utility to create an assembly that provides a Wrapper for the AR_Provider component.
tlbimp AR_Provider.dll /out:NETAR_Provider.dll
Now you can test the ability of a Visual Basic .NET application to use an object from a legacy COM component.
Private Sub frm AR_Provider _Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim rpt As New NETAR_Provider.Exporter Dim fs As IO.FileStream Dim f As IO.File fs = f.Create("c:\test.pdf") fs.Write(rpt.PDFexport, 0, rpt.PDFExport.Length) fs.Close() System.Diagnostics.Process.Start("c:\test.pdf") End Sub
You will see an Acrobat Reader window with the exported Active Reports 2.0 report.