图像未在DynamicReports

时间:2017-09-22 09:53:01

标签: java dynamic-reports

我正在尝试在DynamicReport中的列中渲染图像。但是它没有渲染 我试过以下方式。 首先,我建立了一个专栏

  @Override
    public ComponentColumnBuilder designImageColumn(ReportVO input, String columnName) throws ReportEngineException {

            DynamicReportVO dynamicReport = input.getDynamicReport();
            Map<String, DynamicColumnVO> columns = dynamicReport.getColumnsMap();

            DynamicColumnVO column = columns.get(columnName);

            BODataTypeBuilder boDataTypeBuilder = new BODataTypeBuilder();
            ImageBuilder image = null;

            if(column.getName().equals("Image ")){
                image = cmp.image(new ImageExpression()).setFixedDimension(150, 150);
                LOGGER.info("ImageBuilder created " + image);
            }

            ComponentColumnBuilder componentColumnBuilder = null; 

            ColumnBuilders col = new ColumnBuilders();
            componentColumnBuilder=col.componentColumn(column.getTitle(), image); 


            LOGGER.info("componentColumnBuilder created and returning.. " + componentColumnBuilder);

            return componentColumnBuilder;
        }

然后我构建了一个Image Expression类来评估列

public class ImageExpression extends AbstractSimpleExpression<InputStream>{
    private static final long serialVersionUID = 1L;

    @Override
    public InputStream evaluate(ReportParameters reportParameters) {

  return new ByteArrayInputStream((byte[]) reportParameters.getValue("Image"));
    }
}

但是我没有在imageExpression中获得ReportParameters中Image的值。由于它是投掷来源评估错误。任何领导都会有所帮助。在此先感谢

0 个答案:

没有答案