How to wrap column data in birt report

Viewed 2413

Text wrap in Table cell - so value came in next row and not cut half way. use this code in expression to achieve result.

 if (dataSetRow["cell_name"]== null) { '' }
   else {
     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["cell_name"], 5 );
 
       }

2 Answers

Above are correct, after add the code need to whitespace change to auto.enter image description here

Related