Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Using Active Reports v1.1 via the COM Interlop (http://www.velocityreviews.com/forums/t77242-using-active-reports-v1-1-via-the-com-interlop.html)

mehul 05-03-2004 12:07 PM

Using Active Reports v1.1 via the COM Interlop
 




Hi,

I am trying to use Active Reports v1.1
(Build 1.1.0.84) in a ASP.NET application.

Is it possible to use it through the COM interlop
as Crystal Reports for .NET which comes built in
with VS.NET doesnt work properly.

Rgs,
Mehul

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Natty Gur 05-04-2004 06:07 AM

Re: Using Active Reports v1.1 via the COM Interlop
 
hi,

1) Basically you can use any COM object from ASP.NET. If the COM object
run as STA (single thread apartment) you should add AspCompat attribute
to your page. AspCompat change your page thread model so it won't run as
multi-thread.

2 ) there is ASP.NET version of Active report 2.0 :
http://www.datadynamics.com/Products...?Product=ARNET

3) What the problems with crystal? you can consult their site
(http://www.businessobjects.com/produ...ult.asp?ref=de
vzone_netzone_nav) or post them here.


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

mehul 05-04-2004 11:27 AM

Re: Using Active Reports v1.1 via the COM Interlop
 


Thanks,

What i was looking is a 'How to Guide' - step by step if somebody has
done that. I also have Active Reports v2.
I dont see a need to buy Active Reports.NET if i can use Active Reports
v2 via COM.

Regarding Crystal Reports, I have done what they suggest - i have
already spent too much time on it.

My experience with Active Reports is positive on the other hand.

Rgs,
Mehul

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

mehul 05-12-2004 09:40 AM

Re: Using Active Reports v1.1 via the COM Interlop
 


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="arviewer.cab">

</Object>


<Script LANGUAGE="VBScript">

<!—
' Set the data path to the relative path
' of your pages output
Sub Window_onLoad()

ARViewer1.DataPath="salesbycountry.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(iFormat As eOutputFormat)

Debug.Print "OutputFormat: ", 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 ActiveReportsPDFExport.ARExportPDF


Debug.Print "RunReport"


Select Case m_iReport
Case erptAnnualReports: Set rpt = New rptAnnualReport
Case erptCatalog: Set rpt = New rptCatalog
Case erptCustomerLabels: Set rpt = New rptCustomerLabels
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="VBSCRIPT" %>

<%
Dim rptServer
Dim fname


Set rptServer = CreateObject("ARASPSample.ReportServer")
rptServer.Report = Request.Form("cboReport")

rptServer.OutputFormat = 1
If rptServer.RunReport() Then
fname = rptServer.FileName
%>

<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="VBScript">

<!--
Sub window_onload()
' set the initial reportsource data path

arv.DataPath="Reports/<%Response.Write fname%>"

end sub
-->
</script>
<%else%>
<BODY>
<P>
Error: Unable to create report.<BR>

Please send email to <A
HREF="mailto:ActiveReports.Support@DataDynamics.co m">ActiveReports.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="WebForm2.aspx.vb"
Inherits="AccessReportAutomation.WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm2</title>
<meta content="Microsoft Visual Studio.NET 7.0"
name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<OBJECT id="ARViewer1" style="WIDTH: 448px; HEIGHT:
422px" codeBase="arviewer.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.Diagnostics

Public Class Mehul_Class
Public Property Report(ByVal iRpt As eReport)
Get

Dim hr As Long

Debug.Write("Report: ", iRpt)

m_iReport = iRpt

End Get
Set(ByVal Value)

End Set
End Property



Public Property Let OutputFormat(iFormat As eOutputFormat)

Debug.Print "OutputFormat: ", iFormat

m_iFormat = iFormat
End Property


Public Property FileName() As String
Get
Debug.Write("FileName")

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 ActiveReportsPDFExport.ARExportPDF()


Debug.Write("RunReport")


Select Case m_iReport
Case erptAnnualReports : rpt = New rptNewReport()
Case erptCatalog : rpt = New rptCatalog()
Case erptCustomerLabels : rpt = New rptCustomerLabels()
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_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)
rpt = Nothing
pdf = Nothing
RunReport = True
End Function


End Class



Question is what do i convert


Public Property Let OutputFormat(iFormat As eOutputFormat)

Debug.Print "OutputFormat: ", 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!


All times are GMT. The time now is 11:39 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.