如何在Web API应用程序中使用FastReport

下载FastReport.Net最新版本

在本文中,我们将创建一个用于从服务器接收FastReport报表的API。首先,让我们定义API是什么。从字面上看,这个缩写代表了应用程序的软件界面。这意味着应用程序具有提供对其功能的访问的接口。在Web应用程序的上下文中,API是一种Web服务,具有一组与后端(应用程序或数据库)交互的方法。换句话说,系统对我们来说是一个黑盒子,只有Web方法允许我们使用它。

因此,我们确定Web Api是一个带有一组Web方法的Web服务。这些可以是HTTP协议支持的四种基本CRUD功能。它们由请求实现:GET - 读取,POST - 创建,PUT - 更改,DELETE - 删除。

我们将在本文中创建此Web应用程序。而专为.Net Core框架设计的FastReport.Core将为我们生成报表。 创建一个ASP .Net Core Web应用程序。在向导的第二步中创建一个新项目,您可以选择Web应用程序的类型 - Web API:

首先,我们需要使用Nuget包管理器连接库。

要安装FastReport.Core和FastReport.Web包,您需要选择本地存储库。但是,它必须配置。在存储选择下拉列表旁边有一个齿轮图标。单击它并查看设置窗口:

选择“Local package source”并更改源的路径。然后,单击“Update”按钮。现在,在包管理器中,我们可以安装FastReport.Core和FastReport.Web。 在我们的演示中,我们将了解如何从服务器下载报表,如何在浏览器中查看报表以及如何将参数传递给报表。因此,我们将使用的主要实体是报表。让我们将Reports类添加到数据模型中,该模型将包含两个字段:Id - 报表标识符,ReportName - 报表名称。

模型Reports.cs

 public class Reports
 {
 // Report ID
 public int Id { get; set; }
 // Report File Name
 public string ReportName { get; set; }
 }

在Controllers包中,默认情况下有一个ValuesController.cs类。我们用它。 在使用部分,我们需要库:


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
FastReport 6.6.17 Enterprise Source Code for Delphi7 and Delphi27 (10.4 Sydney) FastReport Package Simplification Management Toolkit by xander.xiao@gmail.com, version 2.0, 2020-5-27 What is Package simplification management ? As Fastreport include a stack of design package files, it is boring to install these packages manually, we need a easy way to work out it, here is my solution which may apply to any package management besides Fastreport: My solution, in a brief, copy all files of all packages in one folder which is named by a Environment varible %ProjectHome% which has following structure: %ProjectHome%\Bin for all BPL files of all packages, runtime and design time files %ProjectHome%\LibD7 for Delphi 7 Compiled unit files and resource files (dcu,dcp,dfm,res etc.) %ProjectHome%\LibD26 for Delphi XE 10 Rio Compiled unit files and resource files (dcu,dcp,dfm,res etc.) Each Delphi version related folder may have platform (Win32,Win64 etc.) and configuration (release or debug) specified subfolders. after that, double click REG files to import Delphi known design time packages. This toolkit include two sets: 1. Resource translation, this function is provided by res\FR4Trans.exe, res\frccEx.exe and res\Chinese\@Deploy.bat, besides Chinese it can work with any language 2. Package simplification management, it is functioned by @DelUnUsedFiles.bat,@Deploy.bat,@BuildAllPackages.bat and REG files in quickInstall folder All source code included, you can modified freely. Usage: step0: Make a backup of your fastreport source code, then copy all files in this folder to FastReport home folder. Step1: Execute recompile.exe to generate specified version related folder and files (Recompile all package first, then Change Language to Chinese or othor one). step2: Execute @DelUnUsedFiles.bat to delete unused files in the folder which step1 generated. step3: Execute @Deploy.bat to deploy all files to the project home folder. step4: Double Click reg files in quickInstall folder to install design time BPLs in Delphi IDE, here assume that your ProjectHome is D:\Projects, you may change it. step5: optional, Instead of "recompile.exe-Recompile all package", Execute customized @BuildAllPackages.bat to recompile all package files if you modified any file in the folder which step1 generated. Step6: optional, Instead of "recompile.exe-Change Language to", Execute res\chinese\@deploy.bat if you need very formated Chinese resource code files, before this, you can Execute res\FR4Trans.exe to do translating in your prefered way, you may copy res\chinese\@deploy.bat to othor language folder.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值