iReport solves the problem of incompatibility between textfield and staticText when making form details template for page header.

   This week my boss gave me a task about using iReport to create a vehicle usage detailed report. On the premise that I have never used this component, I relied on my poor knowledge and experience, and despite the serious lack of relevant solution information on the Internet, through arduous thinking and perseverance, I spent 3 days and finally completed this The problem is solved.

   When using iReport to make a form template, the overlap between textfields and the incompatibility of the staticText tag cause the form to appear messy when generated.

Problem 1: The textfield content is too long and does not automatically wrap and display, as shown below:

You can see that the car department is not fully displayed.

Solution: Design interface, click on the corresponding textField attribute interface - "stretch With Overflow attribute, select

 Problem 2: Overlapping textFields lead to confusing styles, as shown below:

You can see that because the content of the car department is too long and has been expanded vertically, the content of the driver column is blocked.

Solution: In the design interface, click on the property interface of the corresponding textField - "stretch With Overflow property, select -" Select "Float" for the Position Type property, and select "Relative to Tallest Object" for the Stretch Type property. The completed effect is as follows:

 Problem 3: The label that the driver belongs to does not change with the position of the textfield, which is derailed, as shown above.

Solution: 1. Use the component "Frame", as shown in the figure:

2. Place the corresponding staticText and textField on the Frame tag

3. The frame attribute "Position Type" is set to "Float"

4. Set the label attribute "Position Type" to "Float" -> "Stretch Type" to "Relative to Band Height"

5. Set the textField attribute "Position Type" to "Float" -> "Stretch Type" to "Relative to Band Height" -> Check "Stretch With Overflow"

The renderings are as follows:

       This problem has troubled me for a lot of time. Since the online explanations are all about form production, there are very few content that specifically cover the layout and production of forms. There are very few solutions to the problem of label derailment. During my difficult search in the sea of ​​despair, I finally found a post about this issue (PS: It's not from CSDN, I forgot the specific website), and it also gave me an oasis of hope. It talks about using the frame component to solve the problem of label derailment. After my in-depth understanding, now I can ensure the complete synchronization of vertical and horizontal labels and textfield from solving the problem of derailment of a single label and textfield. No matter how the textfield is changed or displayed, it will not affect the beauty and clarity of the entire layout. It can truly achieve the typesetting function of iReport and truly allow us to use iReport for form production.

       This is the focus of this blog post. I post this post to protect your precious brain cells for hard-working programmers who encounter the same problem! ! !

Guess you like

Origin blog.csdn.net/lijinquan2009/article/details/102739262