Print horizontal sub-report data

I have a requirement when I need to print the data in my sub-report horizontally and not vertically.

However, basic data still needs to be presented in vertical order.

The report view looks something like the one shown below, where the Subject column will grow horizontally for each record.

I tried to save Subject records as a subreport in the main report, but it does not print horizontally.

TeacherId TeacherName Subject1 Subject2 Subject3 1 Tom Physics Chem Bio 2 Sofie Eng History Geography 3 Monique Eng Chem Physics 

Checked several existing answers, but no hint.

Any help would be appreciated.

0
source share
1 answer

I would share the changes made to achieve the above conclusion, if it helps someone:

  • Create a report that will be embedded as a subreport as an independent report.
  • Change printOrder to "horizontal" and Columns: n (where n can be any value greater than 1)
  • Save the jrxml file.
  • In the main report, add an auxiliary report element. and the addition chose the option "just add a sub-register element".
  • Click the Properties tab of the subreport element by making the following changes:

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

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

here subject is the name of the field for BO objects present as an association in Teacher BO.

0
source

Source: https://habr.com/ru/post/1391434/


All Articles