What is the best way to dynamically generate RDLC report definitions at runtime?

余生颓废 提交于 2019-12-20 04:13:46

问题


I have data that will be generated by users at runtime by performing queries. The shape of the data is unknown because users can choose which fields to bring back.

The application is an ASP.NET MVC web app. The data will be .NET POCOs. However, each object could have properties that are collections of other objects.

I want to use the RDLC format for the reports so that I can leverage the PDF, Excel, Word, etc export functionality.

I envisage the data being displayed in a grid, with nested grids for the collection properties.

  1. What are my options for generating the RDLC data?
  2. Can RDLC handle nested tables/grids for my collection properties requirement?

回答1:


I investigated this theme a year ago, searching for an object model to generate RDLs in memory. There wasn’t one, but there are rumors about. A quick investigation nowadays: An object model called RDLOM exists, but isn’t really supported by Microsoft.

My actual approach uses a self generated object model build upon RDLs scheme.

This is a less-than-ideal solution, because you need to know the generated object in detail and because the object creation code is really ugly. But the other workarounds I found in my investigation use XML or XSLT directly to generate the RDL and they are poor in their own way.



来源:https://stackoverflow.com/questions/3437548/what-is-the-best-way-to-dynamically-generate-rdlc-report-definitions-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!