.NET RDLC 报告矩阵
我在管理 RDLC 报告时遇到了麻烦。我在互联网上找不到任何全面的教程,而且 MSDN 也没有我希望的那么有帮助。
特别是,我在尝试根据客户的要求显示特定的表格/矩阵时遇到了问题。事情是这样的。
在数据库中,我有两个表:(为了保密,用假名替换)
- 太空飞船信息(包含维修价格、燃料和其他太空飞船信息)
- 备件(包含各种备件的信息)
报告中的表格应该出现像这样:
https://i53.photobucket.com/albums/ g59/Sazabi02/Capture.png 。
- 蓝色 标题包含太空飞船信息
- 紫色 标题包含备件信息
- 红色 为总计
需要注意的事项包括:
- 备件列必须是 动态的。有很多种 备件和硬编码一切 是不切实际的。
- 布局被明确指定为这种方式。动力柱放置在
- 宇宙飞船中完全有可能没有任何备件。我在数据库中将其左外连接,但它导致 RDLC 中的列分组为没有备件的宇宙飞船生成一个空白列。
非动态列之间。 (有这个问题。据我所知,列会自动放置在右侧,并且没有选项将它们放置在中间。
我尝试了一些方法。在令人沮丧地尝试使矩阵的工作方式就像我认为的那样,将其分成三个单独的表,一个用于动态,一个用于固定列(实际上是两个,因为一个固定列应该在动态之前,其他列应该在动态之后。 )
任何人都可以提供一些有关如何在 Visual Studio RDLC 报告中执行此操作的见解吗?
I'm having a terrible time managing RDLC reports. I couldn't find any comprehensive tutorials in the internet and MSDN isn't as helpful as I wish it could have been either.
Particularly, I've been having a problem trying to get a particular table/matrix to appear based on a client's requirement. It goes like this.
In the DB I have two tables: (substituted fake names for secrecy's sake)
- Spaceship Info (contains prices for repairs, fuel, and other spaceship info)
- Spare Parts (contains info for a variety of spare parts)
The table in the report should come out as something like this:
https://i53.photobucket.com/albums/g59/Sazabi02/Capture.png
.
- Blue Headers contain Spaceship Info
- Purple Headers contain Spare Parts info
- Red are totals
Things to take note of include:
- Spare Parts columns have to be
dynamic. There are numerous kinds of
spare parts and hardcoding everything
would be impractical. - The layout was explicitly specified to be that way. The dynamic columns are placed in
- It's entirely possible that a spaceship would not have any spare parts. I LEFT OUTER JOINED it in the DB but it caused the column grouping in RDLC to produce a blank column for the spaceships that didn't have spare parts.
between non-dynamic columns. (having problems with this. AFAIK columns are automatically placed on the right side and there's no option to place them in between.
I've tried out a few things. Pounding my head on the keyboard didn't work after frustratingly trying to make the matrix work as I think it was intended to and Like separating it into three separate tables. One for the totals. One for the dynamics and one for the fixed columns. (Two actually because one fixed column should be before and the others after the dynamic ones.)
Can anyone provide some insights on how to do this in Visual Studio RDLC reports?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你想做的事情并不容易,但可以做到,我会给你一些开始的要点。如果您需要更多信息,请询问。至于矛部件的动态列就是这样做的。收集将显示的所有船舶的所有可能零件的列表。Rdlc 文件实际上是一个 xml 文件。您可以使用 XmlDocument 打开它并生成所需数量的列。您可以将 XmlDocument 的更改内容直接传递到报表查看器。在 xml 中添加列有点棘手。首先使用设计器创建 rdlc 报告,保存并创建具有不同名称的 rdlc 文件副本。然后用设计器再次打开它并删除一列。保存并比较两个 xml,这将显示您需要在 xml 中添加新列的内容。通过这种方式,您将创建动态列。作为数据源传递的表必须以包含所有发货列和每个部件的列的方式创建。该表中的每一行都将被发货,并且仅在该部件的列中。船上的零件会有价值。这是现在,如果您需要更多信息,请询问
最好的问候,
Iordan
what you are trying to do is not very easy but it can be done i will give you few points to start. If you need some info more just ask. As far as dynamic columns for spear parts just do like this. Collect list of all possible parts for all ships that will be shown.Rdlc file is actually a xml file. You can open it with XmlDocument and generate as many column as you need. The you can pass the changed content of the XmlDocument directly to the report viewer.Adding column in xml is a little bit tricky. First create the rdlc report using designer, save and create copy the rdlc file with different name. Then open it again with designer and delete one column. Save and compare the two xml this will show you what you need to add in the xml in for new column. This way you will create the dynamic columns.The table you pass as datasource must to be created in such a way that it has all ship columns and column for every part.Every row in this table will be ship and only in the columns for the parts the ship has there will be values.This is for now if you need some more info just ask
Best Regarsd,
Iordan