Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to prevent word cropping when too long
bmario
Hi!
I was wondering if there is a way to force BIRT to split a word in different lines when it is too long to fit in just one, thus preventing that it would appear cropped or incomplete in the output. For example, lets say I have this string: ThisIsAVeryLongStringThatCouldBeEvenLonger
If I have to display that in a column not wide enough, it would appear like: "ThisIsAVer" and the rest of the data will get missed. However, if BIRT displays that same data in the same cell but split in various lines it could be something like this:
ThisIsAVer
yLongStrin
gThatCould
BeEvenLong
er
I created a javascript function that splits a string each X amount of characters adding a whitespace, that way BIRT will create a new line when finds a whitespace, thus achieving an output similar to what I want. However, the fonts letters are not all of the same size, so for the same column and the same value of X I could add an whitespace in the wrong place and then the data will be displayed wrongly.
I was wondering if there is an option or a way to determine if a string is wider than a column's width, so I could split the string in the right place. I think this must be a common issue already.
Any idea?
Find more posts tagged with
Comments
mwilliams
My guess is that your javascript function is probably going to be your best bet, here. I've done this in reports and it's not the greatest, but it works. It definitely looks better if you have a wider column.
I don't know a way that would tell you how wide a given letter is so you can determine where you need to split your text. Though, I do understand what you're talking about. You could always file an enhancement request in the bugzilla at eclipse.org/birt. Hopefully someone else has come up with a solutions for this! My solution would have been what you're already doing. Good luck!
bmario
@mwilliams
:
Oh, I thought there could be a better or easier way to do that. Thanks though
mwilliams
Sorry! If I figure something else out, I'll let you know! Let us know whenever you have questions!