grafro Posted November 13, 2015 Posted November 13, 2015 Hello communityI have the following problem....I am filling a text field with a undefined number of lines because of null able variables. In the report template i solved this with a text field with the height of one line and enabled the attribute "Stretch With Overflow". If at runtime of the report two lines have to be rendered, the text field is stretched to two lines :)The text field is filled like that: ($F{VAR_1} != null ? ("Any text 1:t" + $F{VAR_1} + "tDate: " + $F{DATE_1} + "n") : "")+ ($F{VAR_2} != null ? ("Any text 2:t" + $F{VAR_2} + "tDate: " + $F{DATE_2} + "n") : "")+ ($F{VAR_3} != null ? ("Any text 3:t" + $F{VAR_3} + "tDate: " + $F{DATE_3} + "n") : "")+ ($F{VAR_4} != null ? ("Any text 4:t" + $F{VAR_4} + "tDate: " + $F{DATE_4} + "n") : "")[/code]so far, so good, the number of rows is totally fine. My problem is the formatting i the lines. I try to format the text with tabs, that is working good when all variables have the nearly same length (@picture: what i have: line 1&2). When the variable length is to small or to long i have formatting issues (@picture: what i have: line 3&4).I would need to figure out, how many tabs i need, to format the text properly (@picture: what i want) or it would be very nice to adopt the tab length.I tried to solve the problem with a htmlelement with a contained <table>, but that does not work so good...My only idea left is to make two text fields next to each other with the same printing conditions:Field 1: ($F{VAR_1} != null ? ("Any text 1:t" + $F{VAR_1} + "n") : "")+ ($F{VAR_2} != null ? ("Any text 2:t" + $F{VAR_2} + "n") : "")+ ($F{VAR_3} != null ? ("Any text 3:t" + $F{VAR_3} + "n") : "")+ ($F{VAR_4} != null ? ("Any text 4:t" + $F{VAR_4} + "n") : "") Field 2: ($F{VAR_1} != null ? ("Date: " + $F{DATE_1} + "n") : "")+ ($F{VAR_2} != null ? ("Date: " + $F{DATE_2} + "n") : "")+ ($F{VAR_3} != null ? ("Date: " + $F{DATE_3} + "n") : "")+ ($F{VAR_4} != null ? ("Date: " + $F{DATE_4} + "n") : "") [/code]I think this solution is very ugly...Any ideas how to solve the issue?
peter.w Posted November 13, 2015 Posted November 13, 2015 HiA few questions just to clarify here.Is this a printed report or a web report or both?Would the “any;random;text;” be long enough to wrap over multiple lines?Is it only 3 elements I.E. key detail & date or are there more?Have you tried using columns?Something likecolumnCount="3"columnWidth="170"columnSpacing="10"printOrder ="Vertical"Alternately would a sub report for each element work? ( a bit o.t.t. but if it works...)
grafro Posted November 14, 2015 Author Posted November 14, 2015 hello peter.w, thanks for your input!i want to render a printed report, pdf.the text values of VAR_% must not be line breaked.in the future, the number of so called columns could grow to 4 or 5, but for now 3 is enough.columns are not possible in my case. the text field is an element in the title band of the report and has a width of 3/5 of the total page width. I would love to use a table element with an add row function, based on fields without subdatasets...subreports are no option for me, i thought about a list element but the creation of a proper subdataset out of VAR_1 ... VAR_X is not so easy... I could use a rowbean with a string array as variable to represent the columns and build dynamically a list of those beans and use it as beandatasource for a list element, but thats also not very handy....
Solution hozawa Posted November 14, 2015 Solution Posted November 14, 2015 Won't just setting tab stops to a larger value do?
grafro Posted November 14, 2015 Author Posted November 14, 2015 i solved my roblem by editing the tab stop width. i did not know that property. thanks a lot
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now