Jasperreport Study Notes 6-jrxml label

Source: Internet
Author: User
Tags border color cdata

Original from: http://langhua9527.iteye.com/blog/402317

Jasperreport Learning Notes 6-jrxml tags
The 1.<jasperreport> root element includes many attribute pagewidth,pageheight,leftmargin,rightmargin,topmargin,bottommargin,orientation, Whennodatatype,istitlenewpage,issummarynewpage

Orientation is the horizontal or vertical put, the default is portrait (horizontal), you can also choose landscape (vertical)

Whennodatatype means when the page does not have information, the default is no pages, if you want to display the time without data, use Allsectionsnodetail

Istitlenewpage Indicates whether the title is displayed for each page, false by default

Issummarynewpage whether a summary is displayed on each page, false by default

PageWidth default 595,pageheight default 842,leftmargin and rightmargin default 20,topmargin,bottommargin are default 30

2. Property Control of text
Jasperreport There are several ways to control the properties of text
The first, controlled by <style>element, has his attributes
ForeColor (foreground color, is text)
BackColor (background color)
HAlign (horizontal position center, justified, left, right)
valign (vertical position bottom, middle, Top)
Border (Bezel 1Point, 2Point, 4Point, dotted, None, Thin)
BorderColor (border color)
Padding (narrator, unit pixels)
FontName (font)
FontSize (font size)
Isbold,isitalic,isunderline,isstrikethrough (bold, italic, down line,..)
LineSpacing (1_1_2, Double, single line spacing)
Rotation (rotate, left, None, right, turn 90 degrees)
Isstyledtext (Indicates whether this element is Style,true,false)
IsDefault (indicates whether this style is the default style)
Style (style supports inheritance)

The second method: Control the property in TextElement, the same label as above
Just set the location of the file properties

TextAlignment (Center, justified, left, right)
VerticalAlignment (Bottom, Middle, Top)
There's a difference, style is halign,valign.

<staticText> <reportelement x= "0" y= "0" width= "555" height= "" "/> <textelement linespacing=" Double " Textalignment= "center" verticalalignment= "middle"/> <text>   <![ Cdata[this text is not really important.] > </text></staticText>


The <textElement> element is a sub-element of both <staticText> and <textField>

3. Background control (background)
Mode= "Transparent" must add this, back with

<style name= "Centeredtext" halign= "Center" valign= "Middle"/><style name= "boldcentered" style= "CenteredText "Isbold=" true "/><style name=" Backgroundstyle "style=" boldcentered "fontname=" Helvetica "Pdffontname=" Helvetica-bold "forecolor=" Lightgray "fontsize=" "/><background> <band height=  " 782 ">    < statictext>      <reportelement x= "0" y= "0" width= "555" height= "782" style= "Backgroundstyle" mode= "Transparent" />      <textelement rotation= "None"/>    <text>    <![ cdata[sample]]>    </text>    </staticText>  </band></background>



The control of the picture of the figure

<background> <band height= "391" >  <image>  <reportelement x= "Up" y= "0" width= "391" height = "391"/>   <imageexpression name= "code" ><textField> <reportelement "x=" y= "20" height= " Width= "/> <textFieldExpression> <!["   cdata["Total aircraft Models reported:" +  ($F {fixed_wing_single_engine_cnt}.intvalue () +  $F {fixed_wing_ Multiple_engine_cnt}.intvalue () +  $F {rotorcraft_cnt}.intvalue ())]]> </textfieldexpression></ Textfield>



6.Report Variables
Because the report expressions may be used more than two times, you can consider

<variable name= "fixed_wing_engine_cnt" name= "code" ><textFieldExpression>  <![ cdata["Total Fixed Wing aircraft Models:" + $V {fixed_wing_engine_cnt}]]></textfieldexpression>



The report variables can also do complex operations, which are seen from his attributes.
Name (variables name)
Class (classes, such as Java.lang.Integer)
Calculation (calculation method, average,count,first,highest,lowest,nothing,sum,system,variance)

Resettype (column,group,none,page,report) type of reset, generally used in Group One
Resetgroup (the group name is selected when the type is reset)

The following example

<variable name= "Aircraft_count" resettype= "Group" resetgroup= "Stategroup" > <variableExpression>   <! [cdata[$F {aircraft_serial}]]> </variableExpression> <initialValueExpression>  <![ Cdata[new Java.lang.Integer (0)]]> </initialvalueexpression></variable><group name= "StateGroup" >  ......</group>< used when!--use $v{aircraft_count}-->


7.built-in report Variables (default, initial variable)
$V {page_number} (current page), $V {column_number} (current column), $V {Report_count} (total number of records), $V {Page_count} (total number of pages), $V {Column_count} (How many columns are there altogether)

8. Appropriate conciliation of too much text
With this, it can be properly reconciled, set to True

<textfield isstretchwithoverflow= "true" >    <reportelement x= "0" y= "0" width=    "[]" height= "/>" <textfieldexpression name= "code" ><reportelement x= "0" y= "width=" height=


To hide duplicate values

<!--output duplicate values--><reportelement x= "y=" 0 "height=" width= "164" isprintrepeatedvalues= "false"/> < Textfieldexpression>   <![ cdata["Model:" + $F {model}]]> </textFieldExpression></textField>


1 floor dellsoft 2009-06-06 recommended direct use of Djasper, on the Jasperreport package. Jasperreport design can be done with code. 2 floor langhua9527 2009-06-06 Dellsoft wrote the proposal to use Djasper directly, on the Jasperreport package. Jasperreport design can be done with code.
What is djasper and what is it about?
3 floor langhua9527 2009-06-06 In fact, I was designed with ireport. 4 floor Dellsoft 2009-06-19 specific see
HTTP://DYNAMICJASPER.SOURCEFORGE.NET/5 Building Longlongriver 2009-06-23 I directly use the ireport, directly edit Jrxml file too much trouble, also do not just, This is an almost impossible task for complex reports, first of all, a place where you can go crazy! 6 floor hpgyy 2009-08-25 <div class= "Quote_title" >langhua9527 wrote </div>
<div class= "Quote_div" >
<br>istitlenewpage Indicates whether the title is displayed on each page, defaults to false <br><br>issummarynewpage whether a summary is displayed for each page, false by default <br> <br>
</div>
<p>?</p>
<p><span style= "" > Here is wrong, should be:</span></p>
<p><span style= "" >istitlenewpage: Indicates whether the title is displayed on a separate page, false by default, and True if the first page of the report appears only as a title </span></p>
<p><span style= "" >issummarynewpage indicates whether totals are displayed on a separate page, false by default, or true to indicate that the totals appear on a new page at the end of the report </span></p >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.