пожалуйста, я хочу динамически добавлять изображения во вложенный цикл, я использую 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);
}
контекст("структуры", список_структур)
//мои метаданные настроены так:
metadata.addFieldAsImage("projectionImage", "projection.projectionImage");
в моем шаблоне (.docx) я делаю это:
"#"foreach($structure in $structures){
"#"foreach($orientation in $structure.orientations){
"#"for($projection in $orientation.projections){
//print image by projection
}
}
}