iReport制作报表
2004-12-03 10:27
741 查看
说明1:如何通过iReport编辑预览报表
In this tutorial we will see how to configure iReports for use a ODBC driver.
Microsoft JVM is not compatible with java.sun.jdbc.odbcBridge class (One of the many debatable defects of the Microsoft java implementation). For this reason, the use of a ODBC driver is a bit complex in iReport. As we will see, the adopted solution will be the creation of two database connections, one Microsoft compatible and one Java "Sun" compatible. We will use the first inside of iReport, the second out iReport ( for compilation and preview).
[b]Step1: creation of connections
1) Create an ODBC connection (i.e. an Microsoft Access System Data Source Name named "TEST_iReport")
2) Open iReport and select database->connections menu
4) Create two connection with follow parameters...
First connection (For use with Microsoft JVM):
Name =
JDBC driver =
JDBC URL =
USER =
Second connection (For use with Sun JVM):
Name =
JDBC driver =
JDBC URL =
4000
USER =
Step2: create the report (using iReport wizard)
1) Select File->Report wizard menu
2) Select MS ODBC TEST connection and write a select query for a table in the database
3) Click next and select preferred fields
4) Click next at step 3 of the wizard
5) Select a tabular report, i.e. the classic template and press 'next' button
6) Press the next button for finish report wizard. We have now a report for the selected table
7) Save the report
Step3: it's time to compiling
1) Select Tools->IReportCompiler menu
2) Check the XML file name
3) elect SUN ODBC TEST connection
3) Press the "compile" button
4) If all work correctly, without error, you have successfully compiled your report using an ODBC database connection
JasperReports supported tags (updated to iReport 0.3.1 and Jasperreports 0.5.3)
[/b]
jasperReport
name
yes
columnCount
yes
printOrder
yes
pageWidth
yes
pageHeight
yes
orientation
yes
whenNoDataType
yes
columnWidth
yes
columnSpacing
yes
leftMargin
yes
rightMargin
yes
topMargin
yes
bottomMargin
yes
isTitleNewPage
yes
isSummaryNewPage
yes
scriptletClass
yes
reportFont
name
yes
fontName
yes
size
yes
isBold
yes
isItalic
yes
isUnderline
yes
isStrikeThrough
yes
pdfFontName
yes
pdfEncoding
yes
isPdfEmbedded
yes
isDefault
yes
parameter
name
yes
class
yes
isForPrompting
yes
parameterDescription
yes
defaultValueExpression
yes
property
name
yes
value
yes
queryString
yes
field
name
yes
class
yes
fieldDescription
yes
variable
name
yes
class
yes
resetType
yes
resetGroup
yes
calculation
yes
incrementerFactoryClass
yes
variableExpression
yes
initialValueExpression
yes
group
name
yes
isStartNewColumn
yes
isStartNewPage
yes
isResetPageNumber
yes
isReprintHeaderOnEachPage
yes
minHeightToStartNewPage
yes
groupExpression
yes
groupHeader
yes
groupFooter
yes
background
yes
title
yes
pageHeader
yes
columnHeader
yes
detail
yes
columnFooter
yes
pageFooter
yes
summary
yes
band
height
yes
line
direction
yes
reportElement
positionType
yes
isPrintRepeatedValues
yes
mode
yes
x
yes
y
yes
width
yes
height
yes
isRemoveLineWhenBlank
yes
isPrintInFirstWholeBand
yes
isPrintWhenDetailOverflows
yes
printWhenGroupChanges
yes
forecolor
yes
backcolor
yes
printWhenExpression
yes
graphicElement
stretchType
yes
pen
yes
fill
yes
rectangle
radius
yes
ellipse
yes
image
scaleImage
yes
isUsingCache
yes
hAlign
yes
vAlign
yes
evaluationTime
yes
evaluationGroup
yes
hyperlinkType
yes
imageExpression
class
yes
anchorNameExpression
yes
hyperlinkReferenceExpression
yes
hyperlinkAnchorExpression
yes
hyperlinkPageExpression
yes
staticText
yes
textElement
textAlignment
yes
verticalAlignment
yes
lineSpacing
yes
rotation
yes
isStyledText
yes
font
reportFont
yes
fontName
yes
size
yes
isBold
yes
isItalic
yes
isUnderline
yes
isStrikeThrough
yes
pdfFontName
yes
pdfEncoding
yes
isPdfEmbedded
yes
text
yes
textField
isStretchWithOverflow
yes
evaluationTime
yes
evaluationGroup
yes
pattern
yes
isBlankWhenNull
yes
hyperlinkType
yes
textFieldExpression
class
yes
subreport
isUsingCache
yes
parametersMapExpression
yes
subreportParameter
name
yes
subreportParameterExpression
yes
connectionExpression
yes
dataSourceExpression
yes
subreportExpression
class
yes
elementGroup
no
In this tutorial we will see how configuring iReports and how to create, compile and preview a simple report with Jasperreports and the IReportCompiler class | ||
Step1: 配置iReport 1) Select the menu Database->classpath... 2) Complete Microsoft JVM classpath to your JDBC drivers 3) Complete Java VM classpath to your JDBC drivers, tools.jar and jar files of JasperReports: X:/path/to/jasperreports-0.4.2-project/JasperReports/lib/commons-beanutils.jar X:/path/to/jasperreports-0.4.2-project/JasperReports/lib/commons-collections.jar X:/path/to/jasperreports-0.4.2-project/JasperReports/lib/commons-digester.jar X:/path/to/jasperreports-0.4.2-project/JasperReports/lib/itext-0.92.jar X:/path/to/jasperreports-0.4.2-project/JasperReports/lib/jasperreports.jar X:/path/to/jasperreports-0.4.2-project/JasperReports/lib/xerces.jar4) Set java home (iReport search for installed JDK exploring the windows registry) Step2: the first report (no database connection required) 1) Create a new report named "mydoc" 2) Add a static text element to the title band Pay ever attention to the band linked to your elements !!! 3) Modify the size of font (-->*"FOR EXAMPLE, IF YOU WANT SET SIZE=30*<--) (if it not change, click on font name field and press the tab key... ;-) 4) Align the text to center and modify it 5) Save in a file named mydoc.xml Step3: it's time to compiling 1) Select menu edit->compile... 2) Check the XML file name 3) Press the "compile" button 4) If all worked correctly, without error, you have successfully compiled your first document using iReport Now, you are ready to compiling JasperReports samples Tutorial Two: working with queries...
|
Microsoft JVM is not compatible with java.sun.jdbc.odbcBridge class (One of the many debatable defects of the Microsoft java implementation). For this reason, the use of a ODBC driver is a bit complex in iReport. As we will see, the adopted solution will be the creation of two database connections, one Microsoft compatible and one Java "Sun" compatible. We will use the first inside of iReport, the second out iReport ( for compilation and preview).
[b]Step1: creation of connections
1) Create an ODBC connection (i.e. an Microsoft Access System Data Source Name named "TEST_iReport")
2) Open iReport and select database->connections menu
4) Create two connection with follow parameters...
First connection (For use with Microsoft JVM):
Name =
MS ODBC TEST
JDBC driver =
com.ms.jdbc.odbc.JdbcOdbcDriver
JDBC URL =
jdbc:odbc:TEST_iReport
USER =
administrator
Second connection (For use with Sun JVM):
Name =
SUN ODBC TEST
JDBC driver =
sun.jdbc.odbc.JdbcOdbcDriver
JDBC URL =
jdbc:odbc:TEST_iReport
4000
USER =
administrator
Step2: create the report (using iReport wizard)
1) Select File->Report wizard menu
2) Select MS ODBC TEST connection and write a select query for a table in the database
3) Click next and select preferred fields
4) Click next at step 3 of the wizard
5) Select a tabular report, i.e. the classic template and press 'next' button
6) Press the next button for finish report wizard. We have now a report for the selected table
7) Save the report
Step3: it's time to compiling
1) Select Tools->IReportCompiler menu
2) Check the XML file name
3) elect SUN ODBC TEST connection
3) Press the "compile" button
4) If all work correctly, without error, you have successfully compiled your report using an ODBC database connection
JasperReports supported tags (updated to iReport 0.3.1 and Jasperreports 0.5.3)
[/b]
jasperReport
name
yes
columnCount
yes
printOrder
yes
pageWidth
yes
pageHeight
yes
orientation
yes
whenNoDataType
yes
columnWidth
yes
columnSpacing
yes
leftMargin
yes
rightMargin
yes
topMargin
yes
bottomMargin
yes
isTitleNewPage
yes
isSummaryNewPage
yes
scriptletClass
yes
reportFont
name
yes
fontName
yes
size
yes
isBold
yes
isItalic
yes
isUnderline
yes
isStrikeThrough
yes
pdfFontName
yes
pdfEncoding
yes
isPdfEmbedded
yes
isDefault
yes
parameter
name
yes
class
yes
isForPrompting
yes
parameterDescription
yes
defaultValueExpression
yes
property
name
yes
value
yes
queryString
yes
field
name
yes
class
yes
fieldDescription
yes
variable
name
yes
class
yes
resetType
yes
resetGroup
yes
calculation
yes
incrementerFactoryClass
yes
variableExpression
yes
initialValueExpression
yes
group
name
yes
isStartNewColumn
yes
isStartNewPage
yes
isResetPageNumber
yes
isReprintHeaderOnEachPage
yes
minHeightToStartNewPage
yes
groupExpression
yes
groupHeader
yes
groupFooter
yes
background
yes
title
yes
pageHeader
yes
columnHeader
yes
detail
yes
columnFooter
yes
pageFooter
yes
summary
yes
band
height
yes
line
direction
yes
reportElement
positionType
yes
isPrintRepeatedValues
yes
mode
yes
x
yes
y
yes
width
yes
height
yes
isRemoveLineWhenBlank
yes
isPrintInFirstWholeBand
yes
isPrintWhenDetailOverflows
yes
printWhenGroupChanges
yes
forecolor
yes
backcolor
yes
printWhenExpression
yes
graphicElement
stretchType
yes
pen
yes
fill
yes
rectangle
radius
yes
ellipse
yes
image
scaleImage
yes
isUsingCache
yes
hAlign
yes
vAlign
yes
evaluationTime
yes
evaluationGroup
yes
hyperlinkType
yes
imageExpression
class
yes
anchorNameExpression
yes
hyperlinkReferenceExpression
yes
hyperlinkAnchorExpression
yes
hyperlinkPageExpression
yes
staticText
yes
textElement
textAlignment
yes
verticalAlignment
yes
lineSpacing
yes
rotation
yes
isStyledText
yes
font
reportFont
yes
fontName
yes
size
yes
isBold
yes
isItalic
yes
isUnderline
yes
isStrikeThrough
yes
pdfFontName
yes
pdfEncoding
yes
isPdfEmbedded
yes
text
yes
textField
isStretchWithOverflow
yes
evaluationTime
yes
evaluationGroup
yes
pattern
yes
isBlankWhenNull
yes
hyperlinkType
yes
textFieldExpression
class
yes
subreport
isUsingCache
yes
parametersMapExpression
yes
subreportParameter
name
yes
subreportParameterExpression
yes
connectionExpression
yes
dataSourceExpression
yes
subreportExpression
class
yes
elementGroup
no
相关文章推荐
- ORACLE9i连接SYBASE的透明网关的配置
- OpenOffice,好用的开源办公软件
- Microsoft Visual Studio .NET 2003制作安装程序
- javascript表单之间的数据传递!
- VB五子棋问题,请高手赐教
- 关于数据库备份的问题!
- 備份服務器端SQL SERVER數據庫至本地目錄
- sql server7.0数据库恢复
- Java日记(1) 一. 认识Java
- 一个画图类,类似ms_chart的线图,适用于科学仿真数据分析(二)
- Ant应用(3)
- 使用 .NET 框架将现有代码作为 Web 服务提供
- 移植到 Windows 2000 和 COM+
- 用VB和MTS开发多层数据库应用系统
- 初步研究方向 web services and VR
- 纯编码实现数据库的建立或压缩
- 用ASP备份数据库
- Tomcat中通过JNDI配置访问数据库
- win2003搜索字词问题