[Java报表软件—技术知识]FineReport6.5 Java报表软件离线填写报表 |
离线填报示例
本例以一个实例来展现FineReport Java报表软件离线填写报表功能。
下图为一个雇员统计表:
500)this.width=500'>
FineReport6.5 Java报表软件设计器里的报表设计如下图:
500)this.width=500'>
FineReport6.5 Java报表软件模板中报表填报属性如下:
500)this.width=500'>
保存该模板到C:\FineReport6.2\WebReport\WEB-INF\reportlets目录下,命名为WorkBook1.cpt。
依次点击FineReport文件à输出àExcel格式à原样导出,得下图的.xls文件:
500)this.width=500'>
填写雇员信息如下:
500)this.width=500'>
将其另存,路径为C:\WorkSheet1.xls.。
运行如下导入程序即可将数据导入数据库中,注意此处要特别留心程序中几个路径是否正确。
import java.io.FileInputStream;
import java.util.HashMap;
import com.fr.base.FRContext;
import com.fr.base.dav.LocalEnv;
import com.fr.report.ReportTemplate;
import com.fr.report.io.ExcelImporter;
public class TestUtils {
public void exe() {
// 配置系统运行环境,可以localEnv remoteEnv
com.fr.base.dav.LocalEnv env = new LocalEnv("C:\\FineReport6.5\\WebReport\\WEB-INF");
try {
// 设置
FRContext.setCurrentEnv(env);
// 读取模板
ReportTemplate tpl = env.readTemplate("WorkBook1.cpt");
// 读取Excel文件
FileInputStream file = new FileInputStream("C:\\WorkSheet1.xls");
// 调用方法,具体如下
ExcelImporter.importExcel(tpl, new HashMap(), file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args)
{
TestUtils testUtils = new TestUtils();
testUtils.exe();
}
}
查看数据库中数据见下图:
500)this.width=500'>
至此离线填报成功。
|
|
|

.: 公告
本博客提供详细的java报表软件的制作过程,发布java报表软件的版本更新信息,并适时对国内主流报表软件进行功能比较。 |
|
« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
|
.: 我的分类(专题)
|

.: 最新日志
.: 最新回复
|

blog名称:Java报表软件 日志总数:357 评论数量:69 留言数量:0 访问次数:1212176 建立时间:2006年4月16日 |
|

.: 留言板
|

.: 链接
|

|