【发布时间】: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