First, iReport the current time of the system 1, select TextField type is java.util.Date, select TextField expression Class (type) is Java.util.Date 2. Select the time format in the pattern 3. Write Java.util.Calendar.getInstance () in TextField expression. GetTime () Second, avoid the empty Method One, locate blank when null in the property options Method Two, $F {ABB614}? $F {ABB614}: "" Three, set the time format Method One, you can use the inline function to intercept the string to display 1, using substring to intercept (for string type) $F {AAE036}? (($F {aae036}.tostring ()). substring (0,4) + "year" + ($F {aae036}.tostring ()). substring (4,6) + "month" + ($F {aae036}.tostring ()) . substring (6,8) + "Day"): "" 2. Use the built-in function to fetch (for date type) "Date" + ($F {ABB017}? String.valueof ($F {abb017}.getyear () +1900) + "year" +string.valueof ($F {abb017}.getmonth () +1) + "month" + $F {abb017}.getdate () : "") + "Day Method Two, set Exception class is the date type, and then set the time format in the pattern, you can write yourself, such as xxxx year XX month xx days, but note that if the empty $f{abb614}? $F {ABB614}: "", You can only use blank when null this method Iv. using tags in HTML in ireport such as:<br> 1. Locate the markup selection in the Properties panel as HTML 2. Join <br> in the place where needed V. Make the data in a field print out under certain conditions By setting the field's printwhenexpression, we can limit the value of the field to be printed only under certain conditions, and a Boolean expression in the printwhenexpression, such as: New Java.lang.Boolean ($F {Type}.trim (). Equals ("Mod_cook")) Vi. nested subreports 1, find the subreport in the panel properties, and then drag into the place you want to put, release the mouse, there will be a new report. After the report is created, there will be a parameter,string type named Subreport_dir, which will have a default path that refers to the path of the subreport. Because subreports tend to have multiple data, it is best to put them in a single detail (for example, if there are multiple data in the query, it will be displayed in detail). 2, if the sub-report needs to pass in the data, then first point the Neutron report, and then in the property bar (not the parameters) to find "parameters", create a new one, for example: Name is abz050, expression is $f{abz050}, because the value here is the value after the parent report query, so it is not used with parameter, but field. 3, reference the value in the subreport, first define a variable parameter in the subreport, then reference it. Then why would you find it? Because: When you create a subreport, you also automatically create a parameter, the name defaults to Subreport_dir, which has a default path (the new incoming path overrides the default path). At the same time, you can point the neutron report to see his properties, there is a subreport exception value of $p{subreport_dir} + "subreport name. Jasper", so that the system can be found. Of course, the system will automatically configure some other sub-report properties, specifically create a new one to see it. Seven, automatic line-wrapping If you do not handle it, some fields are too long to be displayed. Select the field, right-click the property, and on the text field, put the stretch with overflow on the hook. At the same time, select all the fields in the row, right-click Properties, and choose relative to tallest object in common's stretch type. Eight, the use of embedded functions Example: ($F {ABB617}). ToString ()). substring (0,4) + "Year" converts the ABB617 (date type) to a string and then intercepts the year Using inline functions in ireport just look at the fields and use them directly. Nine, height according to content automatically become high 1. Select the primary key, find Stretch with overflow in the attribute and select. And put him alone in a detial or something. 2, there is also a property called Stretch type, the default value is no Stretch, can be changed to the relative to Band Height. The second step I personally think can be done is not done. Of course, the function of the second step is useful when making the table, for example: The table is 2 columns, then the data on both sides must be different, or the left is static, then if you do not select this property, you will find that the right side of the data will be expanded, but not on the left, this time, we can set the property, And put them in a separate detial or other container so that the left and right sides will be high. Ten, set a total of several pages, the first few pages
$V {Page_number} indicates the current page, the Text field option evaluation The time selected report is a total of several pages, the now table is the current page. The page number can be set directly in the ireport. "A few pages in the first page" I wrote it in page footer. |