前几日发现水晶报表设计器中设置为横向打印的时候,出来的打印出口中默认选项仍未纵向,遍寻网络无果,只有人说是水晶报表的Bug,只好自己想办法。使用Reflector反编译crystal report后,在CrystalDecisions.Web.ViewerToolbar中发现了如下代码:

    if (info1 != null)
                {
                    builder1.Append("prm.paperorientation = \"");
                    builder1.Append((int) info1.Orientation);
                    builder1.Append("\";\r\nprm.papersize = \"");
                    builder1.Append((int) info1.PaperSize);
                    builder1.Append("\";\r\nprm.drivername = \"");
                    builder1.Append(info1.DriverName);
                    builder1.Append("\";\r\nprm.usedefprinter = \"");
                    builder1.Append(info1.UseDefaultPrinter ? "1" : "0");
                    builder1.Append("\";\r\nprm.usedefprintersettings = \"");
                    builder1.Append(info1.UseDefaultPrinterSettings ? "1" : "0");
                    builder1.Append("\";\r\n");
                } 

而在aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\html\crystalprinthost.html中有以下代码

if (window.dialogArguments.pageorientation) {
    objectTag +="<PARAM NAME=\"PageOrientation\" VALUE=\"";
    objectTag += window.dialogArguments.pageorientation;
    objectTag += "\">";
}

显然会发现标红粗体部分上下不一致,所以导致即便在页面设置了为横向打印,出来依然是默认选项,将html中的pageorientation修改为paperorientation就OK了。注意上边html代码中的第二行正确,不需要修改。


来自:http://www.cnblogs.com/xioxu/archive/2007/01/29/632850.html
posted on 2008-04-22 18:00  微星  阅读(4159)  评论(0编辑  收藏  举报