找回密码
 立即注册

QQ登录

只需一步,快速开始

grape_puppet

中级会员

35

主题

112

帖子

829

积分

中级会员

积分
829
grape_puppet
中级会员   /  发表于:2016-4-21 17:12  /   查看:3402  /  回复:4
本帖最后由 Lenka.Guo 于 2016-4-27 13:39 编辑

两张分开单张打印时,没有问题;同时打印直接重叠在一起了,怎么处理?

4 个回复

倒序浏览
grape_puppet
中级会员   /  发表于:2016-4-21 17:12:58
沙发
  1. private void GenerateReport()
  2.     {
  3.         billtype = Request.QueryString["BillType"];
  4.         billcode = Request.QueryString["BillCode"];

  5.         string[] codelength = billcode.Split(',');

  6.         report = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(Server.MapPath("reportRdlx//Temp3.rdlx")));// 1/2

  7.         // 创建 Container 控件,用户加载 Subreport 控件
  8.         GrapeCity.ActiveReports.PageReportModel.Container container = new GrapeCity.ActiveReports.PageReportModel.Container();
  9.         container.Name = string.Format("Container{0}", 1);
  10.         container.Width = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("1cm");
  11.         container.Height = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("1cm");
  12.         container.Left = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("0cm");
  13.         container.Top = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length((1 * (1 - 1)).ToString() + "cm");
  14.         container.PageBreakAtEnd = true;
  15.         container.PageBreakAtStart = false;
  16.         #region 收
  17.         // 创建 Subreport 控件,用户加载实际报表模板 -- 收料单
  18.         GrapeCity.ActiveReports.PageReportModel.Subreport subreport = new GrapeCity.ActiveReports.PageReportModel.Subreport();
  19.         subreport.Name = string.Format("SubReport{0}", 1);
  20.         subreport.Width = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("1cm");
  21.         subreport.Height = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("1cm");
  22.         subreport.Left = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("0cm");
  23.         subreport.Top = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("0cm");
  24.         GrapeCity.ActiveReports.PageReportModel.Parameter pid = new GrapeCity.ActiveReports.PageReportModel.Parameter();
  25.         pid.Name = "billcode";
  26.         pid.Value = codelength[0].ToString();
  27.         subreport.Parameters.Add(pid);

  28.         //收料单
  29.         subreport.ReportName = "IBMTFormNew.rdlx";
  30.         container.ReportItems.Add(subreport);
  31.         #endregion

  32.         #region 发
  33.         // 创建 Subreport 控件,用户加载实际报表模板    -- 发料单
  34.         GrapeCity.ActiveReports.PageReportModel.Subreport subreport2 = new GrapeCity.ActiveReports.PageReportModel.Subreport();
  35.         subreport2.Name = string.Format("SubReport{0}", 2);
  36.         subreport2.Width = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("1cm");
  37.         subreport2.Height = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("1cm");
  38.         subreport2.Left = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("0cm");
  39.         subreport2.Top = new GrapeCity.ActiveReports.Extensibility.Definition.Components.Length("0cm");
  40.         GrapeCity.ActiveReports.PageReportModel.Parameter pid2 = new GrapeCity.ActiveReports.PageReportModel.Parameter();
  41.         pid2.Name = "billcode";
  42.         pid2.Value = codelength[0].ToString();
  43.         subreport2.Parameters.Add(pid2);

  44.         //发料单
  45.         subreport2.ReportName = "RGiveMatl.rdlx";
  46.         container.ReportItems.Add(subreport2);
  47.         #endregion
  48.         report.Report.Body.ReportItems.Add(container);

  49.         report.Document.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(pageDocument_LocateDataSource);
  50.     }
复制代码
回复 使用道具 举报
grape_puppet
中级会员   /  发表于:2016-4-21 17:13:49
板凳
用的rdl报表。
回复 使用道具 举报
grape_puppet
中级会员   /  发表于:2016-4-21 17:50:31
地板
问题已解决。
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-4-21 17:54:21
5#

代码写的真好~

我理解您的需求是:在同一个Viewer 中通过SubReport 来加载”收料单“和”发料单“两张报表吗?

重叠可能是SubReport 未设置Location 属性而导致的,建议您为SubReport 添加Loacation属性。



评分

参与人数 1满意度 +5 收起 理由
grape_puppet + 5 很给力!

查看全部评分

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部