自訂列印按鈕

1. 概述

1.1 版本

報表伺服器版本
11.0

1.2 問題描述

使用者在遇到 FineReport 報表嵌入 iframe 中的場景時,如果需要列印報表內容,可以自訂列印按鈕並將其放置在報表外部。

1.3 實現思路


如果報表嵌入在 ID 為 reportFrame 的 iframe 中,直接透過 JS 程式碼呼叫 FineReport 內建工具欄中的方法即可。

JS 程式碼格式如下:

document.getElementById('reportFrame').contentWindow.contentPane.pdfPrint();

2. 範例

2.1 範本準備

本文範例將範本%FR_HOME%\webapps\webroot\WEB-INF\reportlets\GettingStarted.cpt嵌入 iframe 中。


2.2 建立 HTML 檔案

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 路徑下,如下圖所示:

2.3 效果預覽

啟動設計器,在瀏覽器端輸入http://localhost:8075/webroot/help/page_demo/print.html,效果如下圖所示:

附件列表


主題: 部署集成
已經是第一篇
已經是最後一篇
  • 有幫助
  • 沒幫助
  • 只是瀏覽
中文(繁體)

滑鼠選中內容,快速回饋問題

滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

不再提示

8s后關閉

獲取幫助
線上支援
獲取專業技術支援,快速幫助您解決問題
工作日9:00-12:00,13:30-17:30在线
頁面反饋
針對當前網頁的建議、問題反饋
售前咨詢
業務咨詢
電話:0933-790886或 0989-092892
郵箱:taiwan@fanruan.com
頁面反饋
*問題分類
不能為空
問題描述
0/1000
不能為空

反馈已提交

网络繁忙

反饋已提交

網絡繁忙