Hi,
Something that I came across from Active Reports helpfiles is that
you can use ARViewer (arviewer.ocx) to view reports in IE (using VB 6).
Below is the way to go about it (in the help files):
_______________ _______________ _______________ _______________ ____________
_______________ _
This is an example of inserting the viewer control into your page. You
will need to set up a licensing package file (LPK) as described in
Microsoft’s Internet Client SDK.
<Object ID="ARViewer1" WIDTH="869" HEIGHT="1143"
CLASSID="clsid: 00C7C2A0-8B82-11D1-8B57-00A0C98CD92B"
codebase="arvie wer.cab">
</Object>
<Script LANGUAGE="VBScr ipt">
<!—
' Set the data path to the relative path
' of your pages output
Sub Window_onLoad()
ARViewer1.DataP ath="salesbycou ntry.rdf"
End Sub
-->
</Script>
You can use ActiveReports to serve reports from your web server. You
will need to create an ActiveX DLL that combines all your reports with a
class that manages running and saving the reports to either an RDF
format or a PDF format.
The class will create an instance of the requested report and save it to
a directory where the ASP script can push it to the client.
Public Property Let Report(iRpt As eReport)
Dim hr As Long
Debug.Print "Report: ", iRpt
m_iReport = iRpt
End Property
Public Property Let OutputFormat(iF ormat As eOutputFormat)
Debug.Print "OutputForm at: ", iFormat
m_iFormat = iFormat
End Property
Public Property Get FileName() As String
Debug.Print "FileName"
m_sFName = StripFileName(m _sFName)
FileName = m_sFName
End Property
Public Function RunReport() As Boolean
Dim rpt As Object
Dim pdf As New ActiveReportsPD FExport.ARExpor tPDF
Debug.Print "RunReport"
Select Case m_iReport
Case erptAnnualRepor ts: Set rpt = New rptAnnualReport
Case erptCatalog: Set rpt = New rptCatalog
Case erptCustomerLab els: Set rpt = New rptCustomerLabe ls
Case Else
RunReport = False
Exit Function
End Select
rpt.Run False
m_sFName = String(255, Chr$(0))
' GetTempFileName is a Win32 API function, you need
' to add the declaration in one of your modules
If Not GetTempFileName (sServerPath, "AR", -1, m_sFName) Then
RunReport = False
Exit Function
End If
m_sFName = Left$(m_sFName, InStr(m_sFName, Chr$(0)) - 1)
Debug.Print m_sFName
If m_iFormat = eRDF Then
rpt.Pages.Save m_sFName
ElseIf m_iFormat = ePDF Then
pdf.FileName = m_sFName
pdf.Export rpt.Pages
End If
Unload rpt
Set rpt = Nothing
Set pdf = Nothing
RunReport = True
End Function
The ASP script will set the two properties Report and Output Format then
run the report.
<%@ LANGUAGE="VBSCR IPT" %>
<%
Dim rptServer
Dim fname
Set rptServer = CreateObject("A RASPSample.Repo rtServer")
rptServer.Repor t = Request.Form("c boReport")
rptServer.Outpu tFormat = 1
If rptServer.RunRe port() Then
fname = rptServer.FileN ame
%>
<CENTER>
<OBJECT ID="arv" WIDTH=95% HEIGHT=95%
CLASSID="CLSID: 00C7C2A0-8B82-11D1-8B57-00A0C98CD92B"
CODEBASE="../bin/arviewer.cab">
<PARAM NAME="_ExtentX" VALUE="17674">
<PARAM NAME="_ExtentY" VALUE="10478">
</OBJECT>
</CENTER>
<BODY FONT="Arial">
<script LANGUAGE="VBScr ipt">
<!--
Sub window_onload()
' set the initial reportsource data path
arv.DataPath="R eports/<%Response.Writ e fname%>"
end sub
-->
</script>
<%else%>
<BODY>
<P>
Error: Unable to create report.<BR>
Please send email to <A
HREF="mailto:Ac *************** ****@DataDynami cs.com">ActiveR eports.Suppo
rt@DataDynamics .com</A><BR>
</P>
<%end if%>
</BODY>
_______________ _______________ _______________ _______________ ____________
_______________ _
By idea is to convert the above sample to Asp.NET.
So we get:
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Web Form2.aspx.vb"
Inherits="Acces sReportAutomati on.WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm2 </title>
<meta content="Micros oft Visual Studio.NET 7.0"
name="GENERATOR ">
<meta content="Visual Basic 7.0" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<OBJECT id="ARViewer1" style="WIDTH: 448px; HEIGHT:
422px" codeBase="arvie wer.cab" height="422" width="448"
classid="clsid: 00C7C2A0-8B82-11D1-8B57-00A0C98CD92B" VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="9483">
<PARAM NAME="_ExtentY" VALUE="8932">
</OBJECT>
</form>
</body>
</HTML>
Its the next part of creating a class that gives problems (have called
the class
- Mehul_class). Here's the code:
Imports System.Diagnost ics
Public Class Mehul_Class
Public Property Report(ByVal iRpt As eReport)
Get
Dim hr As Long
Debug.Write("Re port: ", iRpt)
m_iReport = iRpt
End Get
Set(ByVal Value)
End Set
End Property
Public Property Let OutputFormat(iF ormat As eOutputFormat)
Debug.Print "OutputForm at: ", iFormat
m_iFormat = iFormat
End Property
Public Property FileName() As String
Get
Debug.Write("Fi leName")
m_sFName = StripFileName(m _sFName)
FileName = m_sFName
End Get
End Property
Public Function RunReport() As Boolean
Dim rpt As Object
Dim pdf As New ActiveReportsPD FExport.ARExpor tPDF()
Debug.Write("Ru nReport")
Select Case m_iReport
Case erptAnnualRepor ts : rpt = New rptNewReport()
Case erptCatalog : rpt = New rptCatalog()
Case erptCustomerLab els : rpt = New rptCustomerLabe ls()
Case Else
RunReport = False
Exit Function
End Select
rpt.Run(False)
m_sFName = String(255, Chr$(0))
' GetTempFileName is a Win32 API function, you need
' to add the declaration in one of your modules
If Not GetTempFileName (sServerPath, "AR", -1, m_sFName) Then
RunReport = False
Exit Function
End If
m_sFName = Left$(m_sFName, InStr(m_sFName, Chr$(0)) - 1)
Debug.Write(m_s FName)
If m_iFormat = eRDF Then
rpt.Pages.Save( m_sFName)
ElseIf m_iFormat = ePDF Then
pdf.FileName = m_sFName
pdf.Export(rpt. Pages)
End If
Unload(rpt)
rpt = Nothing
pdf = Nothing
RunReport = True
End Function
End Class
Question is what do i convert
Public Property Let OutputFormat(iF ormat As eOutputFormat)
Debug.Print "OutputForm at: ", iFormat
m_iFormat = iFormat
End Property
into as vb.net doesnt support it? Also statements like
m_iReport = iRpt
in the 1st Report property - give an error that "Name m_iReport is not
declared".
However if in the help files is not declared anywhere (or am i missing
something?).
[See above for code that was provided in the help files].
Pls help,
Rgs,
Mehul
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!