翻譯|使用教程|編輯:楊鵬連|2021-03-30 09:38:04.850|閱讀 477 次
概述:在本章中,我們將學習FastReport中使用報表的原則。我們還將仔細介紹如何使用FastReport.Service.dll創建Web服務。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
FastReport .Net是適用于Windows Forms,ASP.NET,MVC和.NET Core的全功能解決方案。它可以在Microsoft Visual Studio 2005-2019中使用。支持.Net Framework 2.0-4.x,.NET Core 3.0及以上版本。
在FastReport .NET 2021.1的新版本中,我們實現了對.NET 5的支持。添加了新條形碼-Deutsce Post Leitcode。將RTF轉換為報告對象的算法已得到顯著改進。并且還添加了用于轉換數字的新功能。歡迎下載體驗。(點擊下方按鈕下載)
立即點擊下載FastReport.NET v2021.1最新版
Fastreport.NET在線購買價更低,專享85折起!趕緊加入購物清單吧!
使用FastReport .Net提供的庫FastReport.Service.dll(WCF服務庫)實現網絡服務有一個簡單的方法。
我們的例子是基于創建一個具有web服務功能的簡單web應用程序,但您可以基于.NET Framework 4.0或更高版本修改您現有的項目。
運行Visual Studio并在.NET Framework 4.0下創建一個新的ASP.NET Web應用程序項目。
添加對庫FastReport.dll、FastReport.Bars.dll、FastReport.Service.dll的引用 在站點根目錄下創建一個名稱為ReportService.svc的新文本文件。
<%@ ServiceHost Service="FastReport.Service.ReportService" %> <%@ Assembly Name="FastReport.Service" %>打開web.config,在<配置>部分添加這段代碼。
<appSettings> <!-- path to folder with reports --> <add key="FastReport.ReportsPath" value="C:\Program files\FastReports\FastReport.Net\Demos\WCF" /> <!-- name of connection string for reports --> <add key="FastReport.ConnectionStringName" value="FastReportDemo" /> <!-- Comma-separated list of available formats PDF,DOCX,XLSX,PPTX,RTF,ODS,ODT, MHT,CSV,DBF,XML,TXT,FPX. You can delete any or change order in this list. --> <add key="FastReport.Gear" value="PDF,DOCX,XLSX,PPTX,RTF,ODS,ODT,MHT,CSV,DBF, XML,TXT,FPX" /> </appSettings> <connectionStrings> <add name="FastReportDemo" connectionString="XsdFile=;XmlFile=C:\Program Files\FastReports\FastReport.Net\Demos\Reports\nwind.xml"/> </connectionStrings> <system.serviceModel> <services> <service behaviorConfiguration="FastReportServiceBehavior" name="FastReport. Service.ReportService"> <endpoint address="" binding="wsHttpBinding" contract="FastReport.Service. IFastReportService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="FastReportServiceBehavior"> <serviceMetadata httpGetEnabled="True" /> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <basicHttpBinding> <binding messageEncoding="Mtom" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00" maxReceivedMessageSize="67108864" maxBufferSize="65536" transferMode="Streamed"> <security mode="None"> <transport clientCredentialType="None" /> </security> </binding> </basicHttpBinding> </bindings> </system.serviceModel>"FastReport.ReportsPath "這個鍵應該包含一個報告的文件夾的路徑,你可以把它設置為演示文件夾"\FastReport.Net\Demos/WCF"。例如,你可以將其設置為演示文件夾"\FastReport.Net\Demos\WCF"。
鍵 "FastReport.ConnectionStringName "應該包含連接字符串名稱。這一行應該在<connectionStrings>部分注冊。
讓我們運行我們的網站,通過訪問文件ReportService.svc來檢查Web服務的可用性。
客戶端程序的例子可以在文件夾 \FastReport.Net/Demos/C#/WCFClient 和 \FastReport.Net/Demos/C#/WCFWebClient 中找到。在Visual Studio中打開每個項目,右擊ReportService,在彈出的對話框中選擇配置服務參考。
在配置窗口中指定現有Web服務的地址。
還想要更多嗎?您可以點擊閱讀【FastReport 報表2020最新資源盤點】,查找需要的教程資源。讓人興奮的是FastReport .NET正在慧都網火熱銷售中!低至3701元起!>>查看價格詳情
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: