最近一个项目使用ReportViewer来呈现本地RDLC模块的报表,需要用户点击至少三次才能直正打印, 用户感觉易用性很不好,需要我们修改。
经过网上查找相关资料,发现直接使用ACTIVEX控件RSClientPrint直接打印使用SQLSERVER报表服务的 资料很多,也说的比较详细,可唯独没打印本地报表的相关内容,看来只能自已摸索了。
经过研究有关打印SQLSERVER报表服务的资料,特别是这篇文章: http://www.codeproject.com/KB/reporting-services/RsClientPrint.aspx,决下先写一个简单的HTML 文 件测试一下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<BODY onload="Print()">
<OBJECT ID="RSClientPrint"
classid="CLSID:5554DCB0-700B-498D-9B58-4E40E5814405" CODEBASE="/RSClientPrint-x86.cab" VIEWASTEXT></OBJECT>
<script type="text/javascript" language="javascript">
function Print(oid,name) {
if (typeof RSClientPrint.Print == "undefined") {
alert("Unable to load client print control.");
return;
}
RSClientPrint.MarginLeft = 0;
RSClientPrint.MarginTop = 0;
RSClientPrint.MarginRight = 0;
RSClientPrint.MarginBottom = 0;
RSClientPrint.PageHeight = 296.926;
RSClientPrint.PageWidth = 210.058;
RSClientPrint.Culture = 2052;
RSClientPrint.UICulture = 2052;
RSClientPrint.UseSingleRequest = true;
RSClientPrint.UseEmfPlus = true;
RSClientPrint.Print ("http://localhost:2940/JDCJY/ReportHandler.ashx", "oid="+escape(oid)+"&name="+escape (name), "test");
}
</script>
</BODY>
</html>