Showing posts with label wrap. Show all posts
Showing posts with label wrap. Show all posts

Wednesday, January 6, 2016

How to wrap attributes in Birt based on space.


In the attribute which you want to wrap add the following code which wraps after every space to next line

if(dataSetRow["description"]!=null){
  dataSetRow["description "].replace(/ /g,"\n")
 }


/ /g à means white space anywhere in the string

----------------------------------------------------------------------------

All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Saturday, October 24, 2015

How to wrap data attributes in Birt Report

Below function would be useful for wrapping the data present in a field.

if(dataSetRow["description"]!=null){
function wrap(longStr,width){ length = longStr.length; if(length <= width) return longStr; return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width)); }wrap( dataSetRow["description"], 15 );
}

in the above function, i am trying to wrap description field to a size of 15.

Only disadvantage of this is that it includes hard stops so after every 15 characters which can be frustrating to a user who uses the report in a excel sheet.

----------------------------------------------------------------------------
All the messages below are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.