0

入れ子になったループに画像を動的に追加したいので、docx をテンプレートとして使用します。私は xdocreport 1.0.2 と速度を使用します。

ここに私のコードがあります:

List<Obect> structureList=new arrayList<Object>();



HashMap<String, Object> structureMap = new HashMap<String, Object>();

    for(Structure sutructure:structureList){

      List<Obect> orientationList=new arrayList<Object>();

      //orientation can be vertical or horizontal;

        for(Orientation orientation: OrientationList){

         HashMap<String, Object> orientationMap = new HashMap<String, Object>();

         List<Obect> projectionList=new arrayList<Object>();

               for(integer projection: projectionList){

             HashMap<String, Object> projectionMap = new HashMap<String, Object>();

                     projectionMap.put("projectionImage",  getImageproviderByOrientationAndProjection(orientation, projection);

                       projectionList.add(projectionMap);

              }

     orientationMap.put("projections", projectionList); 

     orientationList.add(orientationMap);

      }
    structureMap.put("orientation", orientationList);

     structureList.add(structureMap);

   }

context("構造", structureList)


//私のメタデータは次のように設定されています:

metadata.addFieldAsImage("projectionImage", "projection.projectionImage");


私のテンプレート(.docx)では、これを行います:

 "#"foreach($structure in $structures){

      "#"foreach($orientation in $structure.orientations){

           "#"for($projection in $orientation.projections){

         //print image by projection

           }
       }
   }
4

1 に答える 1