当总列数未知时如何创建 RDLC 报告?
我正在创建的报告之一具有动态列数 - 从存储过程返回数据表,列数取决于数据库中定义的项目数(每个项目一列,除了一些固定列)。
在这种情况下我可以使用 RDLC 报告来生成报告吗?所有计算都已在报告中完成,我查看 RDLC 只是为了导出到 Excel/pdf 并重复页眉/页脚。
One of the reports I am creating has dynamic number of columns - a datatable gets returned from the stored procedure, the number of columns depend on the number of items defined in the database (one column for each item, other than some fixed columns).
Is it possible for me to use RDLC report to generate a report in this case? All the calculations are already done int he report, I am looking at RDLC only for the sake of export to excel/pdf and repeating header/footer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是可能的,但没有简单的解决方案。这是链接到我之前关于这个主题的答案。
稍后进行进一步调查
这是一篇文章描述详细描述了使用自生成的 RDL 对象模型生成的报告。
It is possible, but there is no simple solution. Here is a link to a former answer of mine on this topic.
An additional investigation later
Here is an article describing the mentioned report generation with a self generated RDL object model in detail.
从表面上看,您希望报告以定义的项目为中心,这些项目可能会根据各种报告标准而变化。如果您知道可以返回的所有列,则可以定义 RDL 来绑定所有列,但隐藏未项目定义的列。您只需将列的 Visible 属性绑定到是否已定义的确定即可。
From the sounds of it, you want your report to pivot defined items, which can change with respect to various report criteria. If you know all the columns that COULD come back, you could just define your RDL to bind them all but hide the ones that aren't item defined. You would just have to bind the Visible property of the column to a determination of whether the has been defined.
对于你的问题,
我想你可以使用矩阵而不是表格。
您可以在其中根据您获取的数据动态生成行和列。
在此处检查矩阵的使用
For your Problem,
I guess you can go for matrix instead of tables.
where you can generate rows and columns dynamically according to the data you are getting.
Check here for using of matrix
当数据表中的列不固定时,请在 RDLC 中使用矩阵。
访问 http://www.gotreportviewer.com/matrices/
在这里您会发现两者的用途RDLC 中的表和矩阵。看看哪一款适合您的要求。
Use matrix in RDLC whenever your columns are not fixed in datatable.
Visit http://www.gotreportviewer.com/matrices/
Here you'll find use of both table and matrix in RDLC. See yourself which one suits for your requirement.