开源组件ExcelReport 3.x.x 使用手册(为.netcore而来)

ExcelReport转眼已经开源4年了,期间有很长时间也停止了对它的维护。18年年末有人联系到我,说“兄弟,ExcelReport不错,但什么时候支持.netcore呢?”。我寥寥的回了几句搪塞的话,也没当回事。后来这兄弟又来问我,恰好这时临近春节,我在老家休年假,也没什么事。就答应了。

ExcelReport是什么?

考虑到ER的老用户并不多,这里有必要介绍下ExcelReport是什么? ExcelReport是一款基于模板的Excel报表生成组件。 它基于关注点分离的理念,将数据与样式、格式分离。让模板承载样式、格式,在可视化条件下编辑。让开发人员只需要关注数据,从而简化Excel报表的开发过程。

一点概念?

模板:承载报表的格式&数据的样式

渲染器:指定模板与数据的关系

介绍模板

模板支持两种标签:

  • $[]:parameter
  • <[]、>[]:repeater

parameter:是给数据占坑的,等待被数据覆盖。

repeater:是包裹parameter的,指定一组参数的渲染边界。等待数据驱动重复渲染。

介绍渲染器

SheetRenderer:指定一个sheet模板与数据的关系

RepeaterRenderer:指定一组parameter标签与数据的关系

ParameterRenderer:指定一个parameter标签与数据的关系

组件介绍

关系:

快速入门

步骤一:定义模板

步骤二:引入模板

步骤三:代码

 

 结果:

 更多示例参照:

https://github.com/hanzhaoxin/ExcelReport/tree/master/examples

 

转载于:https://www.cnblogs.com/hanzhaoxin/p/10505872.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Excel Report Builder<br>Excel Report 万能报表平台<br>Excel 使用WEB服务(webservice)访问远程数据库<br>使用本软件可以使你的应用系统(数据库)和excel相连。<br>可以把它嵌入到你的应用系统里,做为应用系统的外挂程序。<br>可以利用excel强大的编辑功能,随心所欲地开发出精美的报表。<br>本软件基于Web Service(Web服务)新技术,所以它支持web网络,<br>可以通过Internet访问远程数据。<br>只要你稍懂SQL,就可以在Excel Report 万能报表平台上设计报表。<br>通过设置字段,参数等信息来设计报表。<br>BI智能报表,支持透视表。<br>提供存储过程接口,便于用户二次开发。<br>有用户管理,报表权限的管理。<br>支持多语种。 <br>软件环境:<br> 客户端: Windows 2000及以上版本,Microsoft Office 2000及以上版本<br> 服务器端:Windows和Linux都可以,jsdk1.4,tomcat5<br> 数据库:支持Oracle, SQL Server 等数据库。<br>下载地址:<br> SQL Server SP3:<br>http://203.208.248.203:81/pan/Excel/sql2ksp3.exe<br>SQL Server SP4:<br>http://download.microsoft.com/download/9/b/f/9bff6646-2cdb-4069-ada0-548be9cb9338/SQL2000-KB884525-SP4-x86-CHS.EXE<br>报表安装包:<br>http://203.208.248.203:81/pan/Excel/j2sdk-1_4_2_06-windows-i586-p.exe<br>http://203.208.248.203:81/pan/Excel/jakarta-tomcat-5.0.27.exe<br><br><br>http://203.208.248.203:81/pan/Excel/Excel_Report_Setup.rar<br>联系方式:<br> http://pansoft.ik8.com<br> QQ: 10124900<br>MSN: bear_pan@hotmail.com<br>E_Mail: bear_pan@163.com<br><br><br>Excel Report Builder<br>Excel Report Builder is an easy and convenient tool for the creation and customization of reports which takes advantage of the formatting and presentation capabilities of Microsoft Excel. The program allows the rapid construction of reports.A GUI style design environment, which allows the user to design their reports visually inside MS Excel. Reports can be saved and then viewed and printed as pure Excel documents. <br>The reports are created and printed rapidly.In fact, it is by harnassing the power of Excel that gives Excel Report Builder these abilities.No technical knowledge is needed in order for the user to customise his or her own reports. <br><br>Key Features of the Database Report Builder for Excel include:<br> Report creation using Microsoft Excel<br> Get data through webservice,so you can get remote data <br> Support of the SQL-queries for the data sets creation<br> Calling of the stored procedures for the data sets creation<br> Creation of the reports with parameters<br> Work with the Microsoft Excel macros<br> Charts creation in a report<br><br>Software:<br> Client: Windows 2000 or above,Microsoft Office 2000 or above<br> Server: jsdk1.4,tomcat5<br> Database: Oracle or SQL Server <br>Download:<br>SQL Server SP3:<br>http://203.208.248.203:81/pan/Excel/sql2ksp3.exe<br>SQL Server SP4:<br>http://download.microsoft.com/download/9/b/f/9bff6646-2cdb-4069-ada0-548be9cb9338/SQL2000-KB884525-SP4-x86-CHS.EXE<br>Excel Report Builder:<br>http://203.208.248.203:81/pan/Excel/j2sdk-1_4_2_06-windows-i586-p.exe<br>http://203.208.248.203:81/pan/Excel/jakarta-tomcat-5.0.27.exe<br><br><br>http://203.208.248.203:81/pan/Excel/Excel_Report_Setup.rar<br><br><br>Contact:<br> http://pansoft.ik8.com <br> QQ: 10124900<br>MSN: bear_pan@hotmail.com<br>E_Mail: bear_pan@163.com<br><br>
report 是一个开源的访问层中间件,基于java平台,依赖于spring,以Mozilla Public License 2.0 协议发布。适用于目前大部分项目的接口测试。以及访问控制层的使用,简化控制层的繁琐代码,简化spring mvc的配置,剥离了请求控制层前的一系列操作,极大的提高项目开发速度,降低学习开发的成本。report项目请求通道采用责任链模式设计,扩展性极强,流程完全可控! ankang-report report 是一个开源的访问层框架,基于java平台,依赖于spring,以Mozilla Public License 2.0 协议发布。可用于接口的调试及性能的展示,以及访问控制层的使用,简化控制层的繁琐代码,简化spring mvc的配置,剥离的请求前的一系列操作,耦合性低,report是请求通道采用责任链模式设计,轻便可控、扩展性强。report的测试统计等功能为你的每一个接口展示一份完美的报告。 report的关键特性: a)让所有接口可视化,易于控制开发、并行开发 b)为每一个接口提供测试统计以及报表展示 c)简化spring mvc繁琐配置 d)report请求通道采用职责链的模式,扩展性强,完全可控 e)支持多种数据请求方式并可扩展,默认可选json,xml方式 report使用方式: a)maven项目加入report依赖,普通项目则导入jar包 b)引入spring文件 spring/ankang-report.xml,web.xml依赖springMVC配置 c)继承ReportStart类, @Component//通过spring注入 可设置为单例 public class BusinessReportConfig extends ReportStart { @Override protected void reginsterReport() { //注册需要被请求的控制层类 reginster(OrderHandler.class); } @Override protected void reginsterResolver() { // 注册自定义的解析器 没有自定义可忽略 reginster(OrderHandler.class); } } d)启动项目,访问localhost:8080/项目名/report/console report可配置项 a)自定义配置文件需采用指定资源地址:report/report-config.properties b)REPORT_SWITCH:true 则开启,反之关闭 默认开启 c)FILETER:自定义过滤器,多个以逗号隔开 d)JSON_BOAY:json数据请求方式key名称,默认为body e)XML_BODY:xml数据请求方式key名称,默认为root f)MONITOR_FILE_PATH:统计数据保存地址 默认为/report/report.cc g)END_INVOKE:请求通道链终端类。 系统默认 <!--如果不是采用report返回体,则必须配置以下几项,否则影响统计结果--> h)IS_DEFINED_RESPONSE:是否自定义返回体结构 i)RESPONSE_CODE:自定义返回体请求状态码字段名 j)RESPONSE_MESSAGE:自定义返回体请求消息字段名 k)RESPONSE_RESULT:自定义返回体数据对象字段名 l)ENCODE:参数编码格式 m)ERROR400_PAGE_PATH:400时返回页面地址 n)ERROR500_PAGE_PATH:500时返回页面地址 o)ERROR401_PAGE_PATH:401时返回页面地址 report注解解释 a)@Alias:标注在需要被请求的类,value属性值为请求时使用的服务名,没有标注的report将不予以处理 b)@HTTP:标注在需要被请求的方法上,value属性值为请求时的方法名,supportMethod属性值为请求类型,默认支持get和post两种,兼容RquestMapping c)@ReportParam:标注在需要注入方法的参数上,继承至ReportRequest的参数体不需要标注,HttpServletRequest不需要标注,兼容RequestParam d)@Activate:标注在自定义的过滤器上,order属性值为排序值,取值范围int,如有重复则顺延 注:自定义解析器扩展,过滤器扩展等等参照源码。
使用 ExcelReport 库可以方便地将数据写入 Excel 文件中。下面是使用 ExcelReport 库将数据追加写入现有的 Excel 文件并保存的代码详述: 1. 导入 ExcelReport 库 在代码文件中导入 ExcelReport 库的头文件,并在工程配置中将 ExcelReport 库添加到链接器的库列表中。 ```c #include <ExcelReport.h> ``` 2. 创建 ExcelReport 对象并打开 Excel 文件 创建 ExcelReport 对象并调用 OpenWorkbook 方法打开现有的 Excel 文件。 ```c ExcelReport excelReport; excelReport.OpenWorkbook("file.xlsx"); ``` 3. 获取工作表对象和表头信息 使用 GetWorksheet 方法获取工作表对象,并使用 GetHeader 方法获取表头信息。 ```c ExcelWorksheet worksheet = excelReport.GetWorksheet("Sheet1"); std::vector<std::string> header = worksheet.GetHeader(); ``` 4. 追加数据到工作表末尾 使用 AddRow 方法将数据追加到工作表末尾。 ```c std::vector<std::string> data = {"1", "2", "3"}; worksheet.AddRow(data); ``` 5. 保存 Excel 文件并释放资源 使用 SaveWorkbook 方法保存 Excel 文件,并在程序结束前调用 CloseWorkbook 方法释放资源。 ```c excelReport.SaveWorkbook(); excelReport.CloseWorkbook(); ``` 完整的代码示例: ```c #include <ExcelReport.h> int main() { ExcelReport excelReport; excelReport.OpenWorkbook("file.xlsx"); ExcelWorksheet worksheet = excelReport.GetWorksheet("Sheet1"); std::vector<std::string> header = worksheet.GetHeader(); std::vector<std::string> data = {"1", "2", "3"}; worksheet.AddRow(data); excelReport.SaveWorkbook(); excelReport.CloseWorkbook(); return 0; } ```

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值