`
234390216
  • 浏览: 10207235 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
博客专栏
A5ee55b9-a463-3d09-9c78-0c0cf33198cd
Oracle基础
浏览量:461548
Ad26f909-6440-35a9-b4e9-9aea825bd38e
springMVC介绍
浏览量:1773273
Ce363057-ae4d-3ee1-bb46-e7b51a722a4b
Mybatis简介
浏览量:1396657
Bdeb91ad-cf8a-3fe9-942a-3710073b4000
Spring整合JMS
浏览量:394320
5cbbde67-7cd5-313c-95c2-4185389601e7
Ehcache简介
浏览量:678812
Cc1c0708-ccc2-3d20-ba47-d40e04440682
Cas简介
浏览量:529774
51592fc3-854c-34f4-9eff-cb82d993ab3a
Spring Securi...
浏览量:1179701
23e1c30e-ef8c-3702-aa3c-e83277ffca91
Spring基础知识
浏览量:464245
4af1c81c-eb9d-365f-b759-07685a32156e
Spring Aop介绍
浏览量:150672
2f926891-9e7a-3ce2-a074-3acb2aaf2584
JAXB简介
浏览量:67335
社区版块
存档分类
最新评论

JasperReport(2)——IReport使用数据源

阅读更多

在上一篇博客里面已经讲了IReport设置数据源的问题。在本博客中将讲述如何使用数据源。

 


 


 


这个时候就可以从左边的Fileds中选择相应的Filed托到右边的设计页面中

 


 

生成的预览界面:

对应的xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report3" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<queryString>
		<![CDATA[select * from t_blog;]]>
	</queryString>
	<field name="id" class="java.lang.Integer"/>
	<field name="content" class="java.lang.String"/>
	<field name="postTime" class="java.sql.Timestamp"/>
	<field name="seenCount" class="java.lang.Integer"/>
	<field name="title" class="java.lang.String"/>
	<field name="blogStore" class="java.lang.Integer"/>
	<field name="owner" class="java.lang.Integer"/>
	<field name="sysCategory" class="java.lang.Integer"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="44" splitType="Stretch">
			<staticText>
				<reportElement x="227" y="12" width="100" height="20" forecolor="#FF0000"/>
				<textElement textAlignment="Center">
					<font size="13" isBold="true"/>
				</textElement>
				<text><![CDATA[标题]]></text>
			</staticText>
		</band>
	</title>
	<pageHeader>
		<band height="35" splitType="Stretch">
			<staticText>
				<reportElement x="227" y="15" width="100" height="20" forecolor="#FF0000"/>
				<textElement textAlignment="Center">
					<font size="13" isBold="true"/>
				</textElement>
				<text><![CDATA[页眉]]></text>
			</staticText>
		</band>
	</pageHeader>
	<columnHeader>
		<band height="40" splitType="Stretch">
			<staticText>
				<reportElement x="70" y="2" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[id]]></text>
			</staticText>
			<staticText>
				<reportElement x="214" y="2" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[title]]></text>
			</staticText>
			<staticText>
				<reportElement x="373" y="2" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[postTime]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="81" splitType="Stretch">
			<textField>
				<reportElement x="70" y="24" width="100" height="20"/>
				<textElement/>
				<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="214" y="25" width="100" height="20"/>
				<textElement/>
				<textFieldExpression><![CDATA[$F{title}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="373" y="26" width="100" height="20"/>
				<textElement/>
				<textFieldExpression><![CDATA[$F{postTime}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="40" splitType="Stretch">
			<staticText>
				<reportElement x="227" y="10" width="100" height="20" forecolor="#FF0000"/>
				<textElement textAlignment="Center">
					<font size="13" isBold="true"/>
				</textElement>
				<text><![CDATA[相当于表尾]]></text>
			</staticText>
		</band>
	</columnFooter>
	<pageFooter>
		<band height="43" splitType="Stretch">
			<staticText>
				<reportElement x="227" y="13" width="100" height="20" forecolor="#FF0000"/>
				<textElement textAlignment="Center">
					<font size="13" isBold="true"/>
				</textElement>
				<text><![CDATA[页脚]]></text>
			</staticText>
		</band>
	</pageFooter>
	<summary>
		<band height="41" splitType="Stretch">
			<staticText>
				<reportElement x="227" y="10" width="100" height="20" forecolor="#FF0000"/>
				<textElement textAlignment="Center">
					<font size="13" isBold="true"/>
				</textElement>
				<text><![CDATA[用于存放一些统计信息的]]></text>
			</staticText>
		</band>
	</summary>
</jasperReport>
 

 

 

 

  • 大小: 27.9 KB
  • 大小: 59.8 KB
  • 大小: 51.9 KB
  • 大小: 15.4 KB
  • 大小: 11.4 KB
0
0
分享到:
评论

相关推荐

    ireport+jasperreport API

    1. 数据源设置:ireport支持多种数据源,包括JDBC、XML、CSV等,使报表可以连接各种数据库获取数据。 2. 报表设计:掌握表格、图表、文本框等元素的使用,以及样式和样式的自定义,能构建出丰富的报表界面。 3. 导出...

    jasperreport and ireport and action export PDF

    JasperReport支持多种数据源,如数据库、XML、CSV等,而且能够与Java应用程序和Web应用程序无缝集成。它的核心功能包括动态数据填充、复杂的布局控制和模板设计。在描述中提到的源码不包含库文件,意味着用户可能...

    Ireport4集成Struts2

    标题"Ireport4集成Struts2"涉及的是Java开发中两个重要的技术组件——iReport和Struts2的整合。iReport是JasperReports库的一个可视化设计工具,用于创建复杂的报表,而Struts2则是一个流行的MVC(模型-视图-控制器...

    jasperreport中文资料——梧桦椰枫(收集).zip

    它使用XML或Java代码来定义报告布局,并支持多种数据源,包括数据库连接、CSV文件、XML数据等。JasperReport与C#语言的结合主要通过iReport设计工具,使得非Java开发者也能利用其功能。 **C#入门详解**:虽然...

    ireport 子报表,行合并实例

    在IReport中,可以定义参数并将它们绑定到子报表的数据源查询。 4. 调整大小和位置:根据需要调整子报表在主报表中的位置和大小。 行合并是报表设计中的另一个高级特性,它允许你在报表中合并多行以创建更复杂的...

    jasperReport测试例子

    它提供了一个灵活的报表设计工具——iReport,用户可以通过拖放操作创建复杂的报表布局。此外,jasperReport还支持参数化报表,允许在运行时传递参数来定制报表内容。 在描述中提到的"所有相关学习资料"可能包括...

    IReport报表制作详解

    2. **设计界面**:设计界面分为两个主要部分——设计视图和预览视图。设计视图用于添加和编辑组件,预览视图则显示报表的最终效果。 3. **字段和数据源**:在设计视图中,你可以从数据源拖动字段到报表单元格。数据...

    jasperreport

    JasperReport支持多种数据源,包括数据库、CSV文件、XML文件等,并能与Java应用程序、Web应用程序或独立的应用程序无缝集成。 在JasperReport 4.0.0版本中,用户可以利用其内置的报表设计工具——JasperDesign,...

    Jasperreport资料

    **JasperReport——深度解析与应用指南** JasperReport是一款强大的开源报表工具,它允许开发者在Java应用程序中创建复杂的报表。作为一个基于纯Java的报表引擎,JasperReport能够处理多种数据源,包括数据库连接、...

    完整的web+ireport报表源代码

    JasperReports是一个强大的报表引擎,能够处理各种复杂的数据源,如SQL查询结果、CSV文件、XML数据等,并将其转换为精美的报表。iReport允许用户通过直观的图形界面设计报表布局,包括表格、图表、文本框等元素,还...

    JasperReport动态生成报表

    报表设计是JasperReport的基础,通常通过JasperReport的图形化设计工具——iReport或Jaspersoft Studio进行。这些工具允许开发者用拖放的方式创建报表布局,包含表格、图表、文本框、图片等多种元素。设计过程中,...

    Jreport—jasperreport的一个实例demo

    JasperReport的设计工具——iReport(现在已合并到Jaspersoft Studio)提供了一个直观的图形用户界面,使得非技术人员也能设计报表。JasperReport与Spring、Hibernate等Java框架兼容良好,可以方便地集成到现有的...

    ireport&jsperreport学习资料

    【ireport&jsperreport学习资料】是一份包含详尽内容的压缩包,主要涵盖了两款在Java领域中广泛使用的报表工具——iReport和JasperReport的学习资源。这两款工具是用于设计和生成复杂的业务报告的强大工具,尤其适用...

    iReport_doc

    通过学习这些文档,你可以系统地了解iReport的设计流程,掌握数据源的配置(如数据库连接、XML数据源等),理解表达式和脚本的使用,以及如何设计复杂的报表结构。同时,你还能了解到如何将报表集成到Java应用或Web...

    ireport教程【经典2】

    【压缩包内容】:jasperreport+ireport学习笔记1.pdf是压缩包内的主要资料,这份PDF文档可能是对iReport使用技巧的详细讲解,涵盖了从安装配置到实际操作的全过程。 以下是iReport的一些关键知识点: 1. **安装与...

    jasperreport 开发指导手册

    2. **数据源与查询**:了解如何连接到各种数据库,编写SQL查询获取数据,并将其绑定到报表元素。 3. **表达式与函数**:熟悉JasperReport的表达式语言(EL),使用内置函数进行计算和条件判断。 4. **样式与排版**:...

    开源报表设计-JasperReport VS BIRT

    JasperReport支持多种数据源,如数据库连接、CSV文件、XML数据等。其报表设计可以通过JasperDesign或iReport工具进行,这两个工具提供了一个直观的GUI界面,便于用户拖放元素并设置样式。JasperReport的优势在于其...

    jasperreport-2.0.5-project.zip

    这款插件以其灵活性和易用性著称,尤其在与iReport——一个直观的报表设计工具配合使用时,能够极大地提升报表创建和修改的效率。 JasperReports的核心功能包括: 1. **报表设计**:JasperReports支持多种类型的...

    java报表jasperReports+ireport

    2. **设计报表**: 在iReport中绘制报表布局,添加数据源和查询,设置样式和格式。 3. **编译报表**: 将设计好的JRXML文件编译成JasperReport模板(.jasper)。 4. **运行报表**: 在Java应用中加载JasperReport模板,...

Global site tag (gtag.js) - Google Analytics