wu8829
发表于 2014-12-10 08:48:00
Demo有错误,无法正常运行,您能否先用文字说说实现的方法?
wu8829
发表于 2014-12-10 09:02:00
是加这段代码吗? Print_Temp.Document.PrintOptions.PageScaling = GrapeCity.ActiveReports.Extensibility.Printing.PageScaling.ShrinkToPrintableArea;
加了这段代码测试,依然无法按预览效果打印
iceman
发表于 2014-12-10 10:06:00
回复 12楼wu8829的帖子
问题已经通过电话沟通,方法为使用 WebViewer 前台打印接口进行打印。
iceman
发表于 2014-12-10 10:44:00
回复 13楼iceman的帖子
http://www.gcpowertools.com.cn/LiveSamples/Temp/NWind_CHS.zip
wu8829
发表于 2014-12-10 11:15:00
public partial class Delivery_Print : System.Web.UI.Page
{
GrapeCity.ActiveReports.PageReport Print_Temp = new GrapeCity.ActiveReports.PageReport();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
CustomizeToolbar();
//创建自定义工具条按钮
ToolButton btnPDF = Tool.CreateButton("PDF");
btnPDF.ToolTip = "导出到 PDF";
btnPDF.Caption = "导出到 PDF";
//设置点击按钮执行的服务
string PDF_Url = "\\ExportControl\\ARExport.ashx?exporttype=PDF&ReportName=Delivery_Report.rdlx&";
PDF_Url = PDF_Url + "Parameter_Name=Delivery_SerialNumber|Company_Name&";
PDF_Url = PDF_Url + "Parameter_Value=" + Request.QueryString["Delivery_SerialNumber"] + "|" + HttpUtility.UrlEncode(Session.Contents["User_Department"].ToString()) + "&";
PDF_Url = PDF_Url + "File_Name=" + Request.QueryString["Delivery_SerialNumber"] + ".pdf";
btnPDF.ClickNavigateTo = PDF_Url;
//添加按钮到 FlashViewer 中
this.WV_Delivery_View.FlashViewerToolBar.Tools.Add(btnPDF);
//////////////////////////////////////////////////
Print_Temp.Load(new System.IO.FileInfo(Server.MapPath("\\Reports") + "\\Delivery_Report.rdlx"));
Print_Temp.Report.ReportParameters.DefaultValue.Values.Add(Request.QueryString["Delivery_SerialNumber"]);
Print_Temp.Report.ReportParameters.DefaultValue.Values.Add(Session.Contents["User_Department"].ToString());
Print_Temp.Document.PrintOptions.PageScaling = GrapeCity.ActiveReports.Extensibility.Printing.PageScaling.ShrinkToPrintableArea;
Print_Temp.Run();
//////////////////////////////////////
this.WV_Delivery_View.FlashViewerOptions.ResourceLocale = "zh_CN";
this.WV_Delivery_View.Report = Print_Temp;
///////////////////////////////
this.WV_Delivery_Print.FlashViewerOptions.ResourceLocale = "zh_CN";
this.WV_Delivery_Print.Report = Print_Temp;
}
}
private void CustomizeToolbar()
{
// 隐藏打印范围按钮
ToolBase btnRang = WV_Delivery_View.FlashViewerToolBar.Tools["PageRangeButton"];
btnRang.Visible = false;
// 隐藏打印按钮
ToolBase btnPrint = WV_Delivery_View.FlashViewerToolBar.Tools["PrintButton"];
btnPrint.Visible = false;
ToolButton btnCPrint = Tool.CreateButton("套打");
btnCPrint.Caption = "套打";
btnCPrint.ToolTip = "套打";
WV_Delivery_View.FlashViewerToolBar.Tools.Insert(0, btnCPrint);
}
}
wu8829
发表于 2014-12-10 13:50:00
工程师,请问还没找到解决方案吗? 另外,我发现您提供的方法有很大的弊端:
预览时,报表加载将损耗一定的时间,点击“套打”后,报表又要重新加载,如果网速、服务器处理速度不是足够快,很明显有延迟打印,甚至让操作者认为点击“套打”后,没反应!不信,您可试试,将数据库不放到本机,放置另外一个服务器(国外),这样一下就能看出延迟的效果了。
如果不是为了解决这个问题,像以前那样打印,顶多就是预览的时候需要加载,打印并不会重新加载报表。
iceman
发表于 2014-12-10 14:21:00
回复 16楼wu8829的帖子
由于产品原因给您使用带来不便,很抱歉。
目前我们有两个问题没有沟通结果:
1.FlashViewer 打印方向这个问题属于产品 bug,我需要反馈给产品组,并且确认修复计划和时间。不过在短时间内修复的可能性不大。
2.WebViewer1 和 WebViewer2 需要加载两个不同 Report 对象。确认后会回复给您。
关于以上两个问题,需要 1~2 个工作日给您进一步反馈。
关于 16# 问题:
“预览时,报表加载将损耗一定的时间。。。。。。”
我不太理解,由于打印代码为前端 js 代码,不会在走后台代码,请问您实际项目中的使用情况和我给你发送的 Demo 相同吗?或者是您如何获取到报表再次加载这个消息的?
谢谢
wu8829
发表于 2014-12-10 14:23:00
呵呵,我看别人发现bug,都有赠送金币什么的,我咋一次都没赠送过哦!
wu8829
发表于 2014-12-10 14:30:00
刚才您说到“由于打印代码为前端 js 代码”,我也认可您的这种解释,我之所以认为有延迟,是因为有一个新问题:
可能需要多点击几次”套打“,打印机才会开始打印。有时候,点击一次”套打“,甚至两次,打印机无反应。
iceman
发表于 2014-12-10 15:21:00
回复 18楼wu8829的帖子
哈哈,这个不仅要送,还要多送些 ,1000 金币。