//这是源代码
using System;
using System.Data;
using System.Net.Sockets;
using DataDynamics.ActiveReports;
namespace Flt.JM00000BC
{
public class Flt_JM00000BC
{
Symptoms: The WebViewer will not automatically print a report without displaying it.
Cause: The WebViewer provides convenience in automating many of the steps involved in providing a
reporting solution, but the cost of this automation is a loss of control of these steps.
Solution: In order to provide no touch printing in ASP.NET, stream the file to the ActiveX viewer control
and then print using vbscript in the ASP code (not the ASP code behind).
1. Place the ActiveX Control on the page as an object. Setting the version to -1,-1,-1,-1 forces Internet
Explorer to check for updates each time the page is rendered. Setting the height and width to 0
allows you to print the report without displaying it. Here is the code that goes in the ASPX page:
<OBJECT id=arv codeBase=bin/arview2.cab#version=-1,-1,-1,-1
height=0
width=0
classid=CLSID:8569d715-ff88-44ba-8d1d-ad3e59543dde>
2. Load the data into the report. Set the DataPath of the viewer object. This can be anything from a
byte array to a hard coded path:
<script language=vbscript>
<!--
sub window_onload()
arv.datapath = "Default.aspx?ReturnReport=1"
end sub
3. Print the report. This is done by syncing the LoadCompleted event of the viewer. Inside a call is made
to the Viewer's PrintReport method with False indicating that no UI is to be displayed:
sub arv_loadcompleted()
arv.PrintReport False
end sub
-->
</script>
这是帮助文档上的说明,我有个几个问题没弄懂
1.asp页面代码编辑窗口,在对象口中,windows、form对象可以显示,但是我自己声明的arv对象不是道啥时候显示、啥时候不显示
2.当arv对象选中后,事件窗口没有arv_loadcompleted()方法,其他的方法可以看到,我用的是C#自己添加如下代码:但是不能自动调用
function arv_loadcompleted()
{
arv.PrintReport(false);
}
3.原码中arv.datapath = "Default.aspx?ReturnReport=1"这个Default.aspx是个啥样的asp页面不大清楚,里面有啥没啥就更没头脑了,我做了如下修改:不知道是否合理
function window_onload(){
arv.datapath = "OutputReport/myactivereport.rtf";
}
请高人指点迷经!!!