Jasperreports报表

Jasperreports报表Jasperreport 技术事先需要 ireport 制作模板一 整合 jasperreport 所需 jar 包 dependency nbsp nbsp nbsp nbsp groupIdorg eclipse birt runtime 3 7 1groupId nbsp nbsp nbsp nbsp artifactIdco lowagie textartifact nbsp nbsp nbsp nbsp version2 1 7versiondepe

Jasperreports技术

事先需要ireport制作模板

,整合jasperreports所需jar

<dependency>

    <groupId>org.eclipse.birt.runtime.3_7_1
groupId>

    <artifactId>com.lowagie.text
artifactId>

    <version>2.1.7
version>


dependency>

  

<dependency>

<groupId>org.codehaus.groovy
groupId>

<artifactId>groovy-all
artifactId>

<version>2.2.0
version>


dependency>

<dependency>

    <groupId>com.lowagie
groupId>

    <artifactId>itext
artifactId>

    <version>4.2.2
version>

    <type>pom
type>


dependency>

<dependency>

<groupId>com.itextpdf
groupId>

<artifactId>itextasian
artifactId>

<version>5.2.0
version>


dependency>

<dependency>

    <groupId>net.sf.jasperreports
groupId>

    <artifactId>jasperreports
artifactId>

   <version>5.2.0
version>

    <exclusions>

<exclusion>

<groupId>com.lowagie
groupId>

<artifactId>itext
artifactId>


exclusion>

<exclusion>

<artifactId>jacksondatabind
artifactId>

<groupId>com.fasterxml.jackson.core
groupId>


exclusion>

<exclusion>

<artifactId>jackson-annotations
artifactId>

<groupId>com.fasterxml.jackson.core
groupId>


exclusion>

<exclusion>

<artifactId>jackson-core
artifactId>

<groupId>com.fasterxml.jackson.core
groupId>


exclusion>


exclusions>


dependency>

 ,代码部分

//设置打开方式,和文件名称

response.setHeader(“Content-Disposition”, “attachment;filename=fd.pdf);

//获取模板

JasperReport compileReport = JasperCompileManager.compileReport(

new FileInputStream(new File(“E:/project/shareProject1.0/src/main/webapp/report5.jrxml”)));

Card card = new Card();

card.setId(9);

card.setStart(new Date(100, 1, 1));

card.setEnd(new Date(200, 1, 1));

PageBean

pages = shareCardService.find(card, card.getStart(), card.getEnd(), 0, 10, “df”);

List

list = pages.getList();

//导入模板数据

JasperPrint fil = JasperFillManager.fillReport(

compileReport,new HashMap

(),
dataSource.getConnection());

//pdf输出端

JRPdfExporter d = new JRPdfExporter();

d.setParameter(JRExporterParameter.JASPER_PRINT, fil);

d.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream());

//导出

d.exportReport();

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/217226.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 上午10:04
下一篇 2026年3月18日 上午10:04


相关推荐

  • Pycharm配置opencv与numpy

    Pycharm配置opencv与numpy下载 opencv 与 numpy 的官网链接 https www lfd uci edu gohlke pythonlibs opencv 下载与 Python 版本和电脑操作系统版本相符合的 whl 文件 cp 后面的数字代表 python 版本 如 python3 8 的版本就是 cp38 python3 9 的版本就是 cp3 8 win 后面的就代表操作系统位数了 我的操作系统是 64 位 python 版本是 3 9 5 因此我下载的就是以下两个文件 下面介绍导入 opencv 的方法

    2026年3月27日
    2
  • 利用前序和中序遍历构建二叉树的递归算法_二叉树先序遍历和后序遍历正好相反

    利用前序和中序遍历构建二叉树的递归算法_二叉树先序遍历和后序遍历正好相反前言在前两篇文章二叉树和二叉搜索树中已经涉及到了二叉树的三种遍历。递归写法,只要理解思想,几行代码。可是非递归写法却很不容易。这里特地总结下,透彻解析它们的非递归写法。其中,中序遍历的非递归写法最简单,后序遍历最难。我们的讨论基础是这样的:

    2025年10月23日
    6
  • linux关闭防火墙命令iptables_centos开启防火墙命令

    linux关闭防火墙命令iptables_centos开启防火墙命令1.iptables常用命令1.1查看是否已经安装了iptables以及iptables版本号iptables-V(注意:V是大写字母V)1.2关闭iptablesserviceiptablesstop1.3启动iptablesserviceiptablesstart1.4重启iptablesserviceiptablesrestart1.5保存命令行中设置的ipt…

    2025年12月8日
    5
  • 简述SOAP协议「建议收藏」

    简述SOAP协议「建议收藏」8个月过去了,依旧清楚的记得研究生复试时,老师问我SOAP协议是啥(当时还不知道这个协议的名字到底该怎么写),今天偶然之间看见了一篇博客提到了SOAP(见下图),于是就查了一下SOAP协议。SOAP是基于XML的简易协议,可使应用程序在HTTP之上进行信息交换。更简单地说:SOAP是用于访问网络服务的协议。什么是SOAP?SOAP指简易对象访问协议SOAP是一种…

    2022年7月27日
    5
  • pycharm 查找替换_word查找和替换功能可以实现

    pycharm 查找替换_word查找和替换功能可以实现方法一:快捷键:ctr(control)+shift+r(replace:替换)方法二:

    2022年8月25日
    10
  • php和Java哪个好?php和Java的对比

    php和Java哪个好?php和Java的对比php 和 Java 哪个好 这个问题应该会有很多人问 但是每种编程语言都有各自的优缺点 所谓的哪个好 不过就是看你习惯于使用哪种或者说你更擅长于哪种 所以今天我们就来说一说 php 和 Java 之间的对比 nbsp 1 php 与 Java 的语法比较 php 是解释执行的服务器脚本语言 首先 php 有简单容易上手的特点 语法和 c 语言比较象 所以学过 c 语言的程序员可以很快的熟悉 php 的开发 java 的学习需要先

    2026年3月17日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号