【问题标题】:The place for the first record is empty in RDLC reportRDLC 报告中第一条记录的位置为空
【发布时间】:2015-04-01 07:00:00
【问题描述】:

我做了一个这样的两栏报告:

Name1----------------------------Name3
Address1-------------------------Address3

Name2----------------------------Name4
Address2-------------------------Address4

但突然它开始给出这样的报告:

      ----------------------------Name3
       -------------------------Address3

Name1----------------------------Name4
Address1-------------------------Address4

Name2
Address2

这是我的代码:

 public ActionResult Report()
        {
            LocalReport lr = new LocalReport();
            string path = Path.Combine(Server.MapPath("~/Report"), "Person.rdlc");
            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return View("Index");
            }
            List<Person> cm = new List<Person>();

            var viewModel = new PersonIndexData();

            viewModel.People = db.Person
            .Include(k => k.Groups)
            .OrderBy(k => k.Name);

            cm = viewModel.People.ToList();



            ReportDataSource rd = new ReportDataSource("DataSet1", cm);
            lr.DataSources.Add(rd);
            string reportType = "pdf";
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string fileNameExtension = string.Empty;



            string deviceInfo =

            "<DeviceInfo>" +
            "  <OutputFormat>pdf</OutputFormat>" +
            "  <PageWidth>8.5in</PageWidth>" +
            "  <PageHeight>12in</PageHeight>" +
            "  <MarginTop>0.5in</MarginTop>" +
            "  <MarginLeft>0.5in</MarginLeft>" +
            "  <MarginRight>1in</MarginRight>" +
            "  <MarginBottom>0.2in</MarginBottom>" +
            "</DeviceInfo>";

            Warning[] warnings;
            string[] streams;
            byte[] renderedBytes;

            renderedBytes = lr.Render(
                "pdf",
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);


            return File(renderedBytes, mimeType);
        }

即第一条记录的地方是空的。你认为它为什么会发生,我该如何摆脱它?我更改了列间距和边距,但没有用。谢谢。

【问题讨论】:

  • 显示产生这个的代码。你显然在某个地方的偏移量有问题
  • @ThomasAndreèLian,已添加,谢谢。

标签: c# asp.net-mvc reporting rdlc


【解决方案1】:

您无法从表中获取第一列的值。这就是它无法显示第一列值的原因。

【讨论】:

  • 如果您有基于您的答案的其他信息,请将其作为编辑发布到您当前的答案,而不是作为全新的答案。目前,事情看起来很混乱,你的两个“答案”几乎都比 cmets 多。
猜你喜欢
  • 1970-01-01
  • 2016-01-22
  • 1970-01-01
  • 2011-06-17
  • 2012-01-13
  • 1970-01-01
  • 2019-12-28
  • 1970-01-01
  • 2021-03-25
相关资源
最近更新 更多