2015-09-23 70 views
0

如何設置Jasper報告中來自不同不同表格的頁腳部分的值?我的意思是說,在頁腳部分有三行,並且我從視圖中獲取數據。現在我的要求是在不同的頁腳行中的不同的表中顯示頁腳部分的數據(例如,我用三行表示三行)?如何設置Jasper報告中的值

+0

如果您更清楚地發佈您的問題並附上您期望的小圖像 – Viki888

回答

0

如何將值作爲參數傳遞?

Java方面

// Call SQL here. 
// select value1, value2, value3 from footer_table where .... 

Map paramMap = new HashMap(); 
paramMap.put("value1", "the footer value1"); 
paramMap.put("value2", "the footer value2"); 
paramMap.put("value3", "the footer value3"); 

JasperPrint print = JasperFillManager.fillReport(jasper, paramMap, connection); 

// Export to PDF 
JasperExportManager.exportReportToPdfFile(print, PdfPath); 

碧玉方

1.新增參數。

name: value1 
Parameter Class: java.lang.String 

2.將TextFields設置爲頁腳並設置文本字段表達式。

$P{value1} 
$P{value2} 
$P{value3}