Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
997 views
in Technique[技术] by (71.8m points)

jasper reports - Stretch a row with data overflow while having multiple rows in a single band

My requirements bind me to have multiple rows in a single "Details" band.

Right now I am having a static text field (which is highlighted in color) in the leftmost column and three text data fields next to it.

What I want in my report is, the static text band along with the three bands should stretch in height when data in either of the three bands overflows, with the next row "properly" displayed below the stretched row. By "properly" I mean the next row elements should have their "top" values the same and be displayed in the same "row".

I tried setting "Stretch with overflow" flag to "true" and "Position" to "float" but the problem is that the next row data is not properly positioned.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have found the answer. The key to the solution is grouping the elements inside a row together.

  1. Remove all the static text labels. Use text fields instead, with the text in quotes. They can be grouped with other text fields and data fields.
  2. Put all the data fields after the quoted text field in the same group as the quoted text field.
  3. Now, do the same with all the rows that you want to display. Separate group for individual row.

Select all the elements in a group, or, all the elements in all the gorups and do this:

  • Set "Position" to "Float"
  • Set "Stretch Type" to "Relative to the tallest object"
  • Check "Print when detail overflows" checkbox.
  • Check the "Stretch with overflow" checkbox.

That's all we can do to make things "stretch" together.

Now, the band would have to stretch dynamically with these stretched details. Just go to the band properties, set Split type to "Default" and split allowed to true. This did the trick for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...