反饋已提交
網絡繁忙
使用者在遇到 FineReport 報表嵌入 iframe 中的場景時,如果需要列印報表內容,可以自訂列印按鈕並將其放置在報表外部。
如果報表嵌入在 ID 為 reportFrame 的 iframe 中,直接透過 JS 程式碼呼叫 FineReport 內建工具欄中的方法即可。
JS 程式碼格式如下:
document.getElementById('reportFrame').contentWindow.contentPane.pdfPrint();
本文範例將範本%FR_HOME%\webapps\webroot\WEB-INF\reportlets\GettingStarted.cpt嵌入 iframe 中。
1)建立print.html,內容如下:
點選下載並解壓獲得 HTML 檔案:print.zip
<!DOCTYPE html><html><head><title>自訂列印</title> <meta http-equiv="Content-Type" content="text/html; " charset="UTF-8"></head><body><div> <button type="button" onClick="document.getElementById('reportFrame').contentWindow.contentPane.pdfPrint()">列印</button></div> <iframe id="reportFrame" src="http://localhost:8075/webroot/decision/view/report?viewlet=段落明細表_mobile.cpt" height="1200px" width="960px"></iframe></body></html>
2)將print.html放置到 %FR_HOME%\webapps\webroot\help\page_demo 路徑下,如下圖所示:
啟動設計器,在瀏覽器端輸入http://localhost:8075/webroot/help/page_demo/print.html,效果如下圖所示:
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
反馈已提交
网络繁忙