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

zhaoliang_dlmedu 2005-03-02 04:14:54
我做的是webform,点打印按钮后,利用ActiveReport直接进行打印,而不在ie中进行预览,请高人指点!!
...全文
461 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用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";
}
请高人指点迷经!!!
 支持ASP.NET-ActiveReports在WebForms应用程序通过使用ASP.NET 服务器控件来使用。这个控件支持分布式web报表,可使用HTML,ActiveX,.NET 和PDF浏览器。完全代码集成-使用Microsoft Visual Studio.NET编辑器用C#或VB.NET编写报表的代码,非常灵活。报表向导-报表向导帮助您开始创建使用集成设计器来定制的简单报表。设计器-对象模版完全显现的对象模版。允许您动态的建立和修改报表Report Creation API提供了完整的运行时访问报表对象和成员功能。最终用户报表设计器终端用户设计器为您提供了向您应用程序加入设计器的功能,同时提供了终端用户报表编辑功能。控件的方法和属性能方便的存储和加载报表布局,监测和控制设计环境,并可根据终端用户的需要定制外观。与ASP.NET集成Web浏览器控件为您提供了web上的快速浏览ActiveReports 以及打印功能,并具有ActiveX浏览器和Acrobat Reader 浏览器类型的属性。RPX 文件HTTP处理器为您提供了在web服务器上轻松的放置报表的功能,并可使您的Internet用户采用HTML 或PDF进行浏览,而不需要编写任何代码。编译的报表HTTP处理器提供了直接访问服务器的程序集编译的ActiveReports,而不需要编写任何ASPX页面。发布-容易部署报表引擎是一个简单处理强名称程序集。程序集可以使用XCopy发布或放置于程序集全局存储器(GAC)。专业版包括HTTP 处理器和服务器并行web控件,用于ASP.NET 报表。设计器-容易学习与.NET 环境完全集成熟悉的用户界面支持C#和Visual Basic.NET报表将作为您应用程序的一部分进行编译,以加快处理速度,增强安全性,并且用户可以有选择的分别发布。初学者报表向导和Microsoft Access 报表导入向导设计器拥有第三方控件(图表控件,图像控件等)。数据访问-容易连接包括OLEDB和SqlClient报表数据源包括灵活的xml数据源绑定到Dataset,DataView,DataTable和任何IListSource 控件数据源属性能在运行时修改,生成ad hoc(动态)报表灵活的非绑定数据预览和输出-容易显示支持C#代码小型部署程序集,适用于Internet 上使用TOC/Bookmarks超链接输出过滤文件格式为RTF、PDF、EXCEL、HTML、TIFF 和文本文件。

111,093

社区成员

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

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

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