PDA

View Full Version : Word wrapping long string-fields?



Anonymous
07-29-2002, 03:22 PM
Hi,
I've got a string-field element that can potentially be quite long. I'm trying to make it wrap at a given width, as the previous postings to the forum suggested, but it seems to be ignoring my width= specifier. Here's the relevant code:


<items height="17" fontname="SansSerif" fontstyle="plain" fontsize="8">
<string-field name="s4df" x="195" y="0" width="20" height="17" fontsize="8"
alignment="left" fieldname="description" fontstyle="italic"/>
</items>

I've tried many different values for width=, 20, 200, 500, 20%, and it seems to be ignoring all of them. I've tried adjusting the height= in both the string-field and in the <items> tag. Nothing seems to work..

Strangely, I have another string-field within a groupheader block in a different section of the report, and it works fine.

Any ideas?

Thanks!

Anonymous
07-31-2002, 10:35 AM
Hi,

the height of the field is important. The Fontsize in Java (Font.getHeight()) is used to calculate the number of rows of an textfield. If (Field.height) is greater than (2 * Font.Height()), then a linewrapping is enabled. Linewrapping is done on word boundies, words itself are not wrapped.

The width is used after the word wrapping is enabled. This parameter influences when a line is broken down. Have a look at the AbstractOutputTarget to see the linebreaking algorithm.

The height of the Itemband is not used for this calculation. The bands heights are currently only used to advance the cursor, no other processing depends on this.

Have more fun,
said Thomas