水平打印子报告数据 [英] Printing a sub report data horizontally

查看:135
本文介绍了水平打印子报告数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我需要以水平顺序而不是垂直顺序打印子报表中的数据。

I have a requirement where in I need to print the data in my sub report in horizontal order rather than vertical.

但是主数据仍然是按垂直顺序显示的。

However the master data is still to be presented in vertical order.

报告显示是这样的对于每条记录,Subject列将水平增长。

The report presentation is something like this below where the Subject column would grow horizontally for each record.

我已尝试将主题记录保存为主报表的子报表,但不会水平打印。

I have tried keeping the Subject records as a subreport to the main report but it does not get printed horizontally.

TeacherId         TeacherName        Subject1      Subject2     Subject3

1                 Tom                Physics        Chem          Bio
2                 Sofie              Eng            History       Geography
3                 Monique            Eng            Chem          Physics

检查了一些现有答案,但没有任何线索。

Checked a few existing answers but no clue.

任何帮助都会很感激。

推荐答案

我会分享所做的更改如果它可以帮助任何人,可以实现上述输出:

I would share the changes done to achieve the above output if it helps anyone:


  1. 创建报告t作为独立报告嵌入子报表。

  2. 将printOrder更改为horizo​​ntal和列:n(其中n可以是大于1的任何值)

  3. 保存jrxml文件。

  4. 在主报告中添加子报告元素。添加时选择了只添加子报表元素选项。

  5. 转到子报表元素的属性选项卡,执行以下更改,如下所示:

  1. Create the report to be embedded as a subreport as an independent report.
  2. Change the printOrder to "horizontal" and Columns: n (where n can be any value greater than 1)
  3. Save the jrxml file.
  4. In the master report add the sub report element. while adding chose the option "just add the subreport element".
  5. Go to the Properties tab of the subreport element do the following changes as below:

Subreport Expression: $P{SUBREPORT_DIR}+"SubReportfileName.jasper"

DataSourceExpression:new net.sf.jasperreportsengine.data.JRBeanCollectionDatasource($ F {subject})

DataSourceExpression: new net.sf.jasperreportsengine.data.JRBeanCollectionDatasource($F{subjects})

,这里的主题是作为教师BO中的关联出现的BO主题的字段名称。

, here subjects is the field name for the BO Subjects present as an association in Teacher BO.

这篇关于水平打印子报告数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆