Home
Analytics
Disable Text Wrap
mos
Hi,
I realised I have no option to disable text wrapping if my text is too long.
Anyone has any solution?
Find more posts tagged with
Comments
mwilliams
Hi mos,
How long is the text that is wrapping? Is it short enough to fit on 1 line or do you want it to cut off when it runs out of room?
aswin
Hi,
My problem is, my text will be a long URL from the database and the report UI is disturbed as the column which has the URL expands the length of the URL.This is because the URL does not contain any spaces. Can u plz give me a solution?
Regards,
Aswin.
mwilliams
Hi Aswin,
What would you like the URL to do? Line wrap? or cut off? What version of BIRT are you using?
mos
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Hi mos,<br />
<br />
How long is the text that is wrapping? Is it short enough to fit on 1 line or do you want it to cut off when it runs out of room?</p></blockquote>
<br />
<br />
<br />
Hi,<br />
<br />
I wan to fit on just 1 line and cut off the remainding of the text when it runs out of the space.
cypherdj
How do you currently display the URL?<br />
<br />
Is it repeating the URL in the caption like the following?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
[url="http://www.google.com"]www.google.com[/url]
</pre>
<br />
if so, you could just truncate the string used in the caption, add ... at the end and leave the actual full string in the href...
aswin
I dont have any <a href ...>asdasd</a> stuff.....I just need to display whatever data is in the database and that happens to be a long URL. for example,<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/forum/newreply.php?do=newreply&noquote=1&p=37721'>http://www.birt-exchange.com/forum/newreply.php?do=newreply&noquote=1&p=37721</a><br
/>
<br />
is a long URL. As this URL dosent contain any spaces in between words/letters , it will expand the column in which it is, and thus making the report look bad. I want to cut(wrap) this url/data. Can you please suggest a way to do this......
cypherdj
Well, assuming you display this information in a DataElement (let's assume this is a table cell).<br />
<br />
Simply double click on the data element, then open up the expression builder for this element.<br />
<br />
Insert the following code (assuming the data set column is url and max number of characters you want to display is 30)<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
urlLength = dataSetRow["url"].length;
maxLength = 30;
if (urlLength > maxLength){
dataSetRow["url"].substring(0, 13) + "..." + dataSetRow["url"].substring(urlLength-14, urlLength)
} else {
dataSetRow["url"]
}</pre>
<br />
you might have have to play with this a bit to get exactly what you want, I haven't tested it, but it's simply truncating your string bang in the middle, leaving the first and last 13 characters and adding ... in between.<br />
<br />
Hope that helps,<br />
Cedric
mwilliams
Exactly the solution I was going to suggest.
mos,
You could also do something like this for cutting off your data when it's longer than will fit in one line. Just set a limit that you know will fit and cut it off at that point.
aswin
Hi,
Thank you very much for the suggestion..But cant I see the whole URL? like other than writing a logic for cutting the url, is there any other way just to display the url in a new line if it exceeds the specified column width? Yes indeed I am displaying the data in a table cell.
Regards,
Aswini.
mwilliams
Aswini,
What output are you using? (i.e. pdf, html, etc.)
aswin
Hi,
I use both html and pdf.
Regards,
Aswini.
mwilliams
Aswini,
What version of BIRT are you using? I'm using BIRT 2.3. If I specify a column width for the column containing a URL, the URL wraps in both HTML and PDF.
aswin
Hi,
I am using Birt 2.1..However I ve downloaded 2.3 as well. I will check in 2.3 and will let you know..Thank you very much for all of your timely responses.
Cheers,
Aswini.
mos
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Exactly the solution I was going to suggest.<br />
<br />
mos,<br />
<br />
You could also do something like this for cutting off your data when it's longer than will fit in one line. Just set a limit that you know will fit and cut it off at that point.</p></blockquote>
<br />
<br />
Hi,<br />
<br />
Thanks for the replies. The text length may varies, how do I know what is my limit? Where can I set my limits? Do you have an example?
mwilliams
mos,
There is no way to check when you're going to run out of room on a given line I don't believe. This would be something that you just pick. By looking at your report designs, you know that, say, about 40 characters will fit before wrapping. So, you set a check that if the string is longer than 37 characters, you display the first 37 characters + "..." or something to show that the text continues.
aswin
Hi,
But they want the whole URL to be visible..That s the main problem..Otherwise, what you guys proposed have worked gr8 for me..can I have a tool tip kind of thing? Like, I show ... to say the text continues, and when anyone rolls mouse over the text, they should be able to see the entire url..
Regards,
Aswini.
mwilliams
Aswini,
I know. That reply was to mos if you look at the top of my response. I can see how it'd be a little confusing in here with more than one question asked though.
aswin
Oh sry for that...I overlooked it ....plz ignore...
Rugtved
I have a similar problem, only I want BIRT to truncate the contents of the data field when it's too long to fit the column.
Can this be done?
The solution, using substring based on length only works properly for monospaced fonts.
Best regards
Steffen
Nele
This can be done in an easy way.
Select the "Data" Element.
Menu Properties - Advanced - Text - WhiteSpace
Set "No Wrapping".
This should do the trick.
Kind Regards,
Nele
mwilliams
I think I remember this property not working in older versions, Nele, but this definitely does now. Thanks for updating this thread!