在ActiveReport中如何直接打印,而不进行预览?

zhaoliang_dlmedu 2005-03-02 04:14:54
我做的是webform,点打印按钮后,利用ActiveReport直接进行打印,而不在ie中进行预览,请高人指点!!
...全文
492 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaoliang_dlmedu 2005-03-08
  • 打赏
  • 举报
回复
//这是源代码
using System;
using System.Data;
using System.Net.Sockets;
using DataDynamics.ActiveReports;
namespace Flt.JM00000BC
{
public class Flt_JM00000BC
{

public static bool PrintActiveReport(Object objTextFile)
{
//test
DataSet myDataSet = null;
DataTable MyDataTable = null;

bool bolPrintSuccess = false;

try
{
myDataSet = (DataSet)objTextFile;
MyDataTable = myDataSet.Tables["test"];

Flt.EUL001.Flt_EUL001 rpt = new Flt.EUL001.Flt_EUL001(); //MyActiveReport
rpt.DataSource = MyDataTable;
rpt.Run(true);
rpt.Document.Print(false,false);
}
catch(Exception e)
{
Console.Write(e.Message);
}
return(bolPrintSuccess);
}
}
}
zhaoliang_dlmedu 2005-03-08
  • 打赏
  • 举报
回复
using System;
using System.Data;
using System.Net.Sockets;
using DataDynamics.ActiveReports;
namespace Flt.JM00000BC
{
public class Flt_JM00000BC
{

public static bool PrintActiveReport(Object objTextFile)
{
//test
DataSet myDataSet = null;
DataTable MyDataTable = null;

bool bolPrintSuccess = false;

try
{
myDataSet = (DataSet)objTextFile;
MyDataTable = myDataSet.Tables["test"];

Flt.EUL001.Flt_EUL001 rpt = new Flt.EUL001.Flt_EUL001(); //MyActiveReport
rpt.DataSource = MyDataTable;
rpt.Run(true);
rpt.Document.Print(false,false);

// rpt.Document.Print(false,false,true);
// rpt.Document.Print();
//
// rpt.Run();
// rpt.Document.Save("C:\\Inetpub\\wwwroot\\PHOENIX\\ReportOutput\\Flt_EUL001.rdf", DataDynamics.ActiveReports.Document.RdfFormat.AR20);
// rpt.Document.Load("C:\\Inetpub\\wwwroot\\PHOENIX\\ReportOutput\\Flt_EUL001.rdf");
// rpt.Document.Print(false,false);
}
catch(Exception e)
{
Console.Write(e.Message);
}
return(bolPrintSuccess);
}
}
}
这是我做的打印方法,当rpt.Document.Print(false,false);时,没有异常,但是打印机没有打印,rpt.Document.Printer属性中PrinterName:“已经设定的打印机无效“,VisibleBounds:"有异常产生{System.Drawing.Printing.InvalidPrinterException}";当rpt.Document.Print(true,false);时,
有执行异常:“Application 的 UserInteractive mode 没有执行、model dialog 的 form 不能表示。显示从 server application 得到的通知 、将 ServiceNotification 的 style 指定为 DefaultDesktopOnly 。”。因为是第一次使用C#的class调用activereport打印,没有找到相关的例子,对于出现的问题不知如何解决,请高人指点!!
zhaoliang_dlmedu 2005-03-08
  • 打赏
  • 举报
回复
using System;
using System.Data;
using System.Net.Sockets;
using DataDynamics.ActiveReports;
namespace Flt.JM00000BC
{
public class Flt_JM00000BC
{

public static bool PrintActiveReport(Object objTextFile)
{
//test
DataSet myDataSet = null;
DataTable MyDataTable = null;

bool bolPrintSuccess = false;

try
{
myDataSet = (DataSet)objTextFile;
MyDataTable = myDataSet.Tables["test"];

Flt.EUL001.Flt_EUL001 rpt = new Flt.EUL001.Flt_EUL001(); //MyActiveReport
rpt.DataSource = MyDataTable;
rpt.Run(true);
rpt.Document.Print(false,false);

// rpt.Document.Print(false,false,true);
// rpt.Document.Print();
//
// rpt.Run();
// rpt.Document.Save("C:\\Inetpub\\wwwroot\\PHOENIX\\ReportOutput\\Flt_EUL001.rdf", DataDynamics.ActiveReports.Document.RdfFormat.AR20);
// rpt.Document.Load("C:\\Inetpub\\wwwroot\\PHOENIX\\ReportOutput\\Flt_EUL001.rdf");
// rpt.Document.Print(false,false);
}
catch(Exception e)
{
Console.Write(e.Message);
}
return(bolPrintSuccess);
}
}
}
这是我做的打印方法,当rpt.Document.Print(false,false);时,没有异常,但是打印机没有打印,rpt.Document.Printer属性中PrinterName:“已经设定的打印机无效“,VisibleBounds:"有异常产生{System.Drawing.Printing.InvalidPrinterException}";当rpt.Document.Print(true,false);时,
有执行异常:“Application 的 UserInteractive mode 没有执行、model dialog 的 form 不能表示。显示从 server application 得到的通知 、将 ServiceNotification 的 style 指定为 DefaultDesktopOnly 。”。因为是第一次使用C#的class调用activereport打印,没有找到相关的例子,对于出现的问题不知如何解决,请高人指点!!
whmjw 2005-03-03
  • 打赏
  • 举报
回复
rptTest rpt=new rptTest();
rpt.DataSource=dt;
rpt.Run(true);
rpt.Document.Print(true,false);
zhaoliang_dlmedu 2005-03-02
  • 打赏
  • 举报
回复
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";
}
请高人指点迷经!!!

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧