|
楼主 |
发表于 2014-12-3 08:23:32
|
显示全部楼层
在报表中需要显示用上述方法存储的图片:
首先将需要显示图片的excel单元格添加批注:display-type:image
相关的reportData需要连接SQLqueryAction(中心思想是给img的src赋BASE64的url值)
示例的queryAction语句如下:
public static Table scoreSheetSQLreport(String fID,String dataModel){
StringBuffer sbSql = new StringBuffer();
sbSql.append("SELECT MY_DriverBasic.FIDENTITYCARD AS fIdentityCard, ");
sbSql.append("MY_DriverBasic.FNAME AS fName, MY_DriverBasic.FSEX AS fSex ");
\\下面是给图片URL赋值
sbSql.append("( 'data:image/bmp;base64,'+CONVERT(NVARCHAR(max),MY_DriverBasic.FDRIVERPIC)) AS fDriverPic ");
sbSql.append("FROM MY_DriverBasic MY_DriverBasic ");
sbSql.append("WHERE MY_DriverBasic.fID ='"+fID+"'");
HashMap<String, String> sqlMap = new HashMap<String, String>();
sqlMap.put(SQL.DEFAULT_DB_NAME, sbSql.toString());
sqlMap.put(DatabaseProduct.MSSQL.name(), sbSql.toString());
Table table = SQL.select(sqlMap, null, dataModel);
return table;
}
|
|