【问题标题】:Column layout of RDLC ReportRDLC 报告的栏目布局
【发布时间】:2014-11-18 21:43:08
【问题描述】:

我正在 Visual Studio 2013 中创建 RDLC 报告。

我在 VS 中设计报表,并创建一个数据表作为报表的基础,然后在运行时创建一个强类型列表并生成报表。

我的报告目前看起来像这样,基本上是针对日期范围 (dd/mm) 我显示时间条目。

但是现在用户希望报告像这样遍历:

我是否应该对日期列进行硬编码并带回一个“平面”记录集,其中包含日期范围内每个日期的时间,或者在 RDLC 报告中是否有办法将我所拥有的记录集转换为列标题?抱歉,我的报告技巧非常基础。

如果有帮助,这是我用于生成报告的 c#,但我的代码很好,更多的是关于如何布局报告,这是这里的问题?

var reportData = this.GetEmployeeReportData(input);

///Create a reporting datasource for our report
ReportDataSource rd = new ReportDataSource("EmployeeMonthlyDS", reportData);

// Setup the report viewer object and get the array of bytes
ReportViewer viewer = new ReportViewer();
viewer.ProcessingMode = ProcessingMode.Local;
viewer.LocalReport.ReportPath = path;
viewer.LocalReport.DataSources.Add(rd); // Add datasource here

byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

Guid id = Guid.NewGuid();
fileName = "Test" + id;

Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
Response.BinaryWrite(bytes); // create the file
Response.Flush(); // send it to the client to download

【问题讨论】:

    标签: c# visual-studio-2013 reportviewer rdlc


    【解决方案1】:

    您的要求需要矩阵报告。这个想法是您的日期值将放置在动态列的标题中,并将项目放入行标题中。这是explanation

    【讨论】:

    • InitKnit,生成的列数有限制吗?我只得到 4 个日期的 4 列,其余的虽然在记录集中返回,但没有显示在 matxi 表中?
    • 不,没有限制。检查您的分组。不看数据很难说会出什么问题,但尽量在一开始就让它变得简单,只需添加按日期分组的列即可。
    • 啊,我把它按时间而不是日期分组。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-13
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 2010-11-20
    相关资源
    最近更新 更多