0

このデザインとしてレポートを生成したかった:

2013                                           2012                       2011
                      NewCol1    NewCol2                  
Dept       Item      col1 col2 col3 col4       col1 col2 col3           col1 col2 col3

Area1
1          A         1    2     4     5         1    2    3              1    2    3 

1          A         1    2     4     5         1    2    3              1    2    3 

1          A         1    2     4     5         1    2    3              1    2    3   


Area2

1          A         1    2     4     5         1    2    3              1    2    3 

1          A         1    2     4     5         1    2    3              1    2    3 

1          A         1    2     4     5         1    2    3              1    2    3   

DynamicJasper を使用し、2013 年、2012 年、2011 年を 3 つの異なるサブレポートと見なして生成しようとしました。しかし、2012 年と 2011 年のデータが異なる行に表示されます。DynamicJasperを使用して上記のレイアウトを設計するのを手伝ってもらえますか? 2013、2012、および 2011 は、同じ行にある 3 つの異なるタイトルです。

public class LayoutDesigner
{
    public DynamicReport buildReportLayout(List<Mylist> list)
               /* List is the Java bean which contains all the data to be exported.*/

            throws ColumnBuilderException, ClassNotFoundException
    {
        int colIndex = 1;
        int colSpanSize;
        FastReportBuilder drb = new FastReportBuilder();

        AbstractColumn columnArea = ColumnBuilder.getNew()        
                            .setColumnProperty(ReportDetails.COLUMN_PROPERTY[0], String.class.getName()) /* ReportDetails conatins header and properties to be mapped.. */
                            .setFixedWidth(true)
                            .setTitle(ReportsDetails.COLUMN_PROPERTY[0]).setWidth(new Integer(100))
                            .build(); 
        AbstractColumn column1 = ColumnBuilder.getNew()        
                            .setColumnProperty(ReportDetails.COLUMN_PROPERTY[1], String.class.getName())
                            .setFixedWidth(true)
                            .setTitle(ReportsDetails.COLUMN_PROPERTY[1]).setWidth(new Integer(100))
                            .build();
                            ........../*  Defining other Abstrct Columns */

        GroupBuilder gb = new GroupBuilder();
        DJGroup djb = gb.setCriteriaColumn((PropertyColumn) columnArea)        

                        .addFooterVariable(column1,DJCalculation.SUM)
                        ........./*   added all essential variables */
                        .setGroupLayout(GroupLayout.VALUE_IN_HEADER)                       
                        .build(); 


        drb.addColumn(columnArea); 
        drb.addColumn(column1); 
        ...

        drb.addGroup(djb);

        /*  I grouped and now doing column span for clubbing col1 col2  under NewCol1. Also col1 col2 under NewCol2. This is also working.
         Problem here is I want one more layer of span to club NewCol1 and NewCol2 under 2013, but this is not working and I am not sure how to do.
         So I thought of 2 reports one containing 3 diferent columns (2013,2012 and 2011)  and another remaining data. But just with 3 different columns I cant show it, since without a column property, I cant define COlumns in a report..*/

        for (int i = 0; i < LAYOUT.length; i++)
        {
            if(ReportDetails.LAYOUT[i].equalsIgnoreCase(ReportDetails.LAYOUT[3]))
            {
                colSpanSize=2;
            }
            else
            {
                colSpanSize=1;
            }
            drb.setColspan(colIndex, colSpanSize,String.valueOf(ReportDetails.LAYOUT[i]));
            colIndex = colIndex + colSpanSize;
        }
        DynamicReport dr = drb.build();
        return  dr;
    }
}
4

1 に答える 1

1

上記を設計するためにできることは次のとおりです。

  1. エリアに基づいてレポートグループを作成します
  2. エリア グループ ヘッダーにエリア ヘッダーを挿入する
  3. 他のすべてのヘッダーを列ヘッダーに入れる
  4. 詳細バンドでは、Dept、Item、および 3 つのサブレポートを並べて配置します。

スクリーンショットも添付しました。

上記要件の設計

于 2014-01-02T08:28:43.983 に答える