Home
Analytics
Not able to wrap dynamic text in a cell
KapsHere
Hi,
My BIRT reports have static text(labels), report parameters and dynamic text(data set columns binded to the table using Data/Dynamic Text/Text elements). The dynamic text in this case gets the values at run time using scripted code on fetch event of the table element.
BIRT automatically wraps the text when it is contained in labels or report parameters, but it does not wrap the dynamic text contained in the elements mentioned above.
Apart from using Javascript, is there any other option to wrap the data in the above mentioned scenario? If the only option is Javascript, what is the best way to do it?
Shouldn't BIRT treat all elements equally for formatting issues like wrapping?
The BIRT environment is:
Business Intelligence and Reporting Tools
Version: 2.3.0.v200804251-7N7Y-AYdeIEKS6mGZPHGhs-0vEl6
Build id: v20080618-0630
BIRT Report Designer
Version: 2.3.0.v20080431-7X7n-ECLmlsLx_z-4z0LEaYz-mA8
Build id: v20080618-0630
BIRT Report Runtime
Version: 2.3.0.v20080516-7g890ELRXmproz-xIDPOJ1
Build id: v20080618-0630
Thanks in advance for any help,
Regards,
Kapil
Find more posts tagged with
Comments
bhanley
Are the column widths set to be proportional or fixed in the table you are inserting the values into? If you format the column widths to a fixed value rather than a proportion or percentage the text will wrap by default.
KapsHere
My mistake!
Actually BIRT is wrapping the dynamic text as well, but it is not breaking the lengthy words in that text, which sometimes results in some part of those lengthy words being chopped off. I am not sure though if this is the desired behaviour!
I guess the only option in this situation is to handle that lengthy word through javascript...rt?
Does anybody have some javscript code for the same?
Regards,
Kapil
wmashal
Hi
this is your perfect solution ,you can use the recursion JavaScript function
function wrap(longStr, width){
length = longStr.length(); if(length <= width)
return longStr;
return (longStr.substring(0, width) + "u200B" + wrap(longStr.substring(width, length), width));
}
you can call it in the dynamic text like this
wrap(dataSetRow["you dynamic"], 20) // wrap on 20 characters
bokya
hi
please tell me where to paste these belows code=>
function wrap(longStr, width){
length = longStr.length(); if(length <= width)
return longStr;
return (longStr.substring(0, width) + "\u200B" + wrap(longStr.substring(width, length), width));
}
and from where do i call these function.
because in my Report i am having table, table is having data set field to which i am assigning values by using Scripted Data source on Open Script of data set. and that Field is nothin but "description". means description can be very large.. but because of this single field othere filds are getting off. so i want to give Wrap code( apply this above code) for description field ,so please let me where do i paste above given code and from where i should call this function.
thanks,
archana.keste
<p>I am also facing same problem. where we need to define wrap method?</p>