翻譯|使用教程|編輯:李顯亮|2021-08-19 10:51:28.343|閱讀 491 次
概述:FastReport Online Designer 是一個跨平臺的報表設(shè)計器,允許通過任何平臺移動設(shè)備創(chuàng)建和編輯報表。本文是設(shè)置在線設(shè)計器的分步手冊。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
沒有報表,就不可能在任何生活領(lǐng)域開展業(yè)務(wù)。無論是鋼廠還是學(xué)校的院系人員——到處都需要報表:會計、統(tǒng)計、運營等等。由于現(xiàn)代世界高度計算機化,報表也以電子方式進行。如果沒有特殊程序——報表生成器,創(chuàng)建大量報表將非常困難。
FastReport報表生成器出現(xiàn)在此類軟件的早期,并在Delphi程序員中大受歡迎。隨著.Net Framework版本的出現(xiàn)——它也已在Microsoft平臺的擁護者中廣泛傳播。
隨著信息時代的深入,web在線操作的時代已經(jīng)來臨,F(xiàn)astreport也順應(yīng)時代的變化,推出了可視化在線報表設(shè)計器——FastReport Online Designer。
設(shè)置在線設(shè)計器的分步手冊。
1. 首先,讓我們從安裝路徑中復(fù)制一個包含在線設(shè)計器(默認為:WebReportDesigner)的文件夾到Web應(yīng)用程序根目錄。
2. 然后檢查web.config文件,查看WebReport功能所需的處理程序設(shè)置。
for IIS6:
<system.web> … <httpHandlers> <addpath="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/> </httpHandlers> </system.web> for IIS7: <system.webServer> <handlers> <addname="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web. Handlers.WebExport"/> </handlers> </system.webServer>
3. 然后檢查WebReportDesigner/scripts/configdata.js文件中報告設(shè)計器的設(shè)置。
'getReportByUUIDFrom': '/FastReport.Export.axd?getReport=', 'saveReportByUUIDTo': '/FastReport.Export.axd?putReport=', 'makePreviewByUUID': '/FastReport.Export.axd?makePreview=',
這些參數(shù)應(yīng)包含處理程序FastReport相對于網(wǎng)站根的路徑。如果你的路徑與所寫的不同,必須加以糾正,例如:
'getReportByUUIDFrom': '/oursite/FastReport.Export.axd?getReport=',
4. 當WebReport在ASPX標記中使用時,你需要在頁面上拖放該對象并設(shè)置屬性。對于MVC,你需要在控制器中編寫代碼:
4.1. 啟用報告的編輯:
webReport.DesignReport = true;
4.2. 為WebReport設(shè)置唯一的對象名稱,這對于在回調(diào)頁面中進一步識別是必要的。頁中進一步識別,同時保持已編輯的報告:
webReport.ID = "MyDesignReport1";
4.3. 禁止在在線設(shè)計器中編輯報告的腳本(如果你想允許編輯--設(shè)置為true):
webReport.DesignScriptCode = false;
4.4. 指定報告設(shè)計器主文件的路徑,帶有設(shè)計器的文件夾應(yīng)被復(fù)制到Web-Application的適當位置:
webReport.DesignerPath = "~/WebReportDesigner/index.html";
4.5. 在網(wǎng)站上設(shè)置回調(diào)頁面的路徑,在報告被保存到臨時文件夾后執(zhí)行調(diào)用。例如,MVC的視圖路徑(你必須在控制器中創(chuàng)建新的空白視圖,專門用于同名的回調(diào)):
webReport.DesignerSaveCallBack = "~/Home/SaveDesignedReport";
or, for ASPX:
webReport.DesignerSaveCallBack = "~/DesignerCallBack.aspx";
在GET請求中發(fā)送的以下參數(shù):
reportID="here is webReport.ID"&reportUUID="here is saved report file name"
在這種情況下,reportID對應(yīng)于WebReport.ID對象,而reportUUID是存儲在臨時文件夾中的文件名。開發(fā)者應(yīng)執(zhí)行進一步的操作,將報告保存到磁盤、數(shù)據(jù)庫或云存儲的源文件中。命名為reportUUID的臨時文件在保存后必須從臨時文件夾中刪除。你可以使用POST查詢來進行報告文件的回調(diào)傳輸,請閱讀下面4.6節(jié)的內(nèi)容。下面是代碼回調(diào)頁面的例子:
4.6. 設(shè)置臨時文件夾的路徑,在調(diào)用回調(diào)之前,將編輯好的報告保存在該文件夾中。你必須給這個文件夾:
webReport.DesignerSavePath = "~/App_Data/DesignedReports";
你可以將屬性webReport.DesignerSavePath設(shè)置為空白字符串來激活POST模式。
4.7. 設(shè)置WebReport對象在服務(wù)器緩存中的壽命,以分鐘為單位,默認為60:
webReport.CacheDelay = 120;
5. 創(chuàng)建一個回調(diào)頁面來保存編輯過的報告。
5.1. 如果你使用ASPX布局,你需要在Page_Load事件處理程序中添加以下代碼:
protected void Page_Load(object sender, EventArgs e) { string reportID = Request.QueryString["reportID"]; string reportUUID = Request.QueryString["reportUUID"]; // 1. ReportID value identifies the object that caused the designer. The value corresponds to the property webReport.ID, which was filled by a call of the designer. // 2. Combining the path that we have filled in the property webReport.DesignerSavePath, and the resulting reportUUID, we get the path to the temporary file with edited report. // 3. This file can be opened and resaved in the appropriate place (another file, cloud, a database, etc). // 4. The temporary file must be deleted after saving. }
5.2. 在MVC標記中,你需要在控制器中創(chuàng)建一個方法和一個空的視圖。控制器中的代碼:
{ // 1. ReportID value identifies the object that caused the designer. The value corresponds to the property webReport.ID, which was filled by a call of the designer. // 2. Combining the path that we have filled in the property webReport.DesignerSavePath, and the resulting reportUUID, we get the path to the temporary file with edited report. // 3. This file can be opened and resaved in the appropriate place (another file, cloud, a database, etc). // 4. The temporary file must be deleted after saving. return View(); }
5.3. 你可以為在線設(shè)計器使用任何本地化:
webReport.DesignerLocale = "en";
("en "可以改成任何其他支持的語言,支持的語言的完整列表類似于設(shè)計器發(fā)布包中 "locales "文件夾中的文件)。
當在回調(diào)頁面創(chuàng)建處理程序時,注意過濾和檢查Get/POST請求中的參數(shù)。一定要檢查它們是否為空值。
使用On-line Designer的最佳位置是在頁面的底部。建議寬度為100%或至少930px。建議對象的高度至少是600px。
還想要更多嗎?您可以點擊閱讀【FastReport 報表2020最新資源盤點】,查找需要的教程資源。讓人興奮的是FastReport .NET正在慧都網(wǎng)火熱銷售中,低至3701元起!>>查看價格詳情
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn