IREPORT production report

xiaoxiao2021-03-06  47

Description 1: How to edit a preview report by Ireport

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: Configuration iReport1) Select the menu Database-> classpath ... 2) Complete Microsoft JVM classpath to your JDBC Drivers3) 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 / itxt-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 "m YDOC "2) Add a static text element to the band link pay super elements !!! 3) MODIFY THE SIZE OF FONT (-> *" for example = 30 * <-) (if it not change, Click ON FONT NAME FIELD AND PRESS the TAB Key ...-) 4) Align TEXT to Center and modify it5) Save in a file named mydoc.xmlstep3: it's time to compiling1 ) Select menu edit-> compile ... 2) Check the XML file name3) Press the "compile" button4) If all worked correctly, without error, you have successfully compiled your first document using iReportNow, you are ready to compiling JasperReports samplesTutorial TWO: WORKING with queries ...

In this tutorial we will see how to connect to a database, execute a query, retrive fields information and grouping rows with a group band.For "detailed" information about how to configuring iReport for enabling database connections (you must simply setup the classpath to find JDBC driver classes), see the tutorial "Tutorial 1: How to compile and preview reports from iReport" Step1:. create a connection1) Select menu Database-> connections2) Press "new" button to create a new connection3) Fill for and test your new connection nbsp; nbsp; in this tutorial we will use MySQL as DB, but the logic is the same for any database4) Press "Save" your new connection will appare in the connections list5) Close the connections windowStep2: read query. fields 1) Create a new report named "tutorial2" 2) Add a static text element to the title band Pay ever attention to the band linked to your elements !!! 3) Save in a file named tutorial2.xml4) Select menu Database- > Report Query5) from Connections Combo box select myconnection6) Write a selection query. In this tutorial we will select all records of table COMUNI (cities) SELECT * FROM COMUNI ORDER BY PROVINCIA, COMUNE7) Press button labeled "read fields", a new window will appare. Pleas wait. .. at the end the fields selected by the query will be inserted in the fields listview8) Press button "Register fields to report" for save fields definition9) Press button "Save to report" for attach query to reportStep3: create a group 1) Open variables window. You Would Have to See the list of the fields2) Select menu view-> groups3) Create a new group ("button) named" group1 "

. 4) Check the box "Start on a new column" 5) Insert the group expression In this tutorial we want see all cities grouped by province The expression value is: $ F {PROVINCIA} 6) Press "OK" to close group definition window, and "close" to close groups list window7) You will see the new group drawed on your documentStep4: drag and drop ... 1) Reopen variables window You would have to see the list of the fields2) Drag the field selected. for grouping (in my case PROVICIA) on the Group1 band ... and drop. A new Field Element will be created3) Drag another field on detail band4) I have added at this point two lines, one linked with Group1Header band, and one linked with detail band.5) Open the ReportProperties (view-> report properties) and set num columns = 2, columns width = 250, spacing = 35Step5: Compilation and preview ... 1) Open the compilator (edit-> compile. ..) 2) SELECT YOUR Connection (for me is "myconnection") 3) Press "compile" Buttontutorial Three: How to use a database Like MS Access Via OD BC Bridge with Ireport 0.0.6Please Note That Form Ireport 0.0.8 This Trick "is no more useful and all jdbc access area Maded Using Pure Java.

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) Step1:. creation of connections1) Create an ODBC connection (ie an Microsoft Access System Data Source Name named "TEST_iReport") 2) Open iReport and select database-> connections menu4) Create two connection with follow parameters ... First connection (For use with Microsoft JVM): Name = MS ODBC TESTJDBC driver = com.ms.jdbc.odbc.JdbcOdbcDriverJDBC URL = jdbc: odbc: TEST_iReportUSER = administratorSecond connection (For use with Sun JVM): Name = Sun ODBC TestJDBC Driver = Sun.jdbc.odbc.JdbcOdbcDriverJDBC URL = jdbc: odbc: TEST_iReportUSER = administratorStep2: create the report (using iReport wizard) 1) Select File-> Report wizard menu2) Select MS ODBC TEST connection and write a select query for a table in the database3) Click next and select preferred fields4) Click next at step 3 of the wizard5) Select a tabular report, ie the classic template and press 'next' button6) Press the next button for finish report wizard. We have now a report for THE SELECTED TABLE7) SAVE The Reportstep3: It's Time To Compiling1) Select Tools-> IreportCompiler Menu2) Check The XML File Name3) Elect Sun ODBC TEST Connection3) Press the "Compile"

button4) If all work correctly, without error, you have successfully compiled your report using an ODBC database connectionJasperReports supported tags (updated to iReport 0.3.1 and Jasperreports 0.5.3) .jrelement {font: bold 9pt Arial;}

.jrattribute {font: Normal 10pt Arial;

.jrsupported {font: Normal 10pt Arial;

Font.fparafo {font: bold 11pt arial;}

Font.ftitle {font: Normal 20pt Arial;

A.fmedio {color: # 000000; Text-Decoration: underline; font: Normal 10pt arial;}

A.fmedio: Hover {color: # aa0000; text-decoration: underline; font: Normal 10pt arial;

A.fmedim {color: # 000000; Text-Decoration: none; font: Normal 10pt Arial;

A.fmedim: hover {color: # aa0000; text-decoration: underline; font: Normal 10pt Arial;

jasperReportnameyescolumnCountyesprintOrderyespageWidthyespageHeightyesorientationyeswhenNoDataTypeyescolumnWidthyescolumnSpacingyesleftMarginyesrightMarginyestopMarginyesbottomMarginyesisTitleNewPageyesisSummaryNewPageyesscriptletClassyesreportFontnameyesfontNameyessizeyesisBoldyesisItalicyesisUnderlineyesisStrikeThroughyespdfFontNameyespdfEncodingyesisPdfEmbeddedyesisDefaultyesparameternameyesclassyesisForPromptingyesparameterDescription yesdefaultValueExpression yespropertynameyesvalueyesqueryString yesfieldnameyesclassyesfieldDescription yesvariablenameyesclassyesresetTypeyesresetGroupyescalculationyesincrementerFactoryClassyesvariableExpression yesinitialValueExpression yesgroupnameyesisStartNewColumnyesisStartNewPageyesisResetPageNumberyesisReprintHeaderOnEachPageyesminHeightToStartNewPageyesgroupExpression yesgroupHeader yesgroupFooter yesbackground yestitle yespageHeader yescolumnHeader yesdetail yescolumnFooter yespageFooter yessummary yesbandheightyeslinedirectionyesreportEle mentpositionTypeyesisPrintRepeatedValuesyesmodeyesxyesyyeswidthyesheightyesisRemoveLineWhenBlankyesisPrintInFirstWholeBandyesisPrintWhenDetailOverflowsyesprintWhenGroupChangesyesforecoloryesbackcoloryesprintWhenExpression yesgraphicElementstretchTypeyespenyesfillyesrectangleradiusyesellipse yesimagescaleImageyesisUsingCacheyeshAlignyesvAlignyesevaluationTimeyesevaluationGroupyeshyperlinkTypeyesimageExpressionclassyesanchorNameExpression yeshyperlinkReferenceExpression yeshyperlinkAnchorExpression yeshyperlinkPageExpression yesstaticText yestextElementtextAlignmentyesverticalAlignmentyeslineSpacingyesrotationyesisStyledTextyesfontreportFontyesfontNameyessizeyesisBoldyesisItalicyesisUnderlineyesisStrikeThroughyespdfFontNameyespdfEncodingyesis

转载请注明原文地址:https://www.9cbs.com/read-85114.html

New Post(0)