Jump to content

BIRT Developer Center
Download


Photo
- - - - -

How do i use word wrap in report design?


  • Please log in to reply
6 replies to this topic

#1 Mylsamy

Mylsamy

    Junior Member

  • Members
  • PipPipPip
  • 33 posts

Posted 09 June 2010 - 07:35 PM

Hi all,

I am using Birt report version 2.3.2.

I created a design in JDBC datasource and access the data.

and the dataset value is dateSetRow["CompnayName"]="sdssssssssssssssssssssssssssssssssssddddddfsfsfdsfdsfsdfsdfdsssssssssssssssssssss" like this.

I display the character is one line with out break the word when i view the report.

But i want to apply the Word wrap to that column.

Can I do this?

Please help me.
Thanks in Advance

Myl

#2 mwilliams

mwilliams

    BIRT Guru

  • Administrators
  • 13684 posts

Posted 11 June 2010 - 09:34 AM

Hi Myl,

You may have to use substrings or insert break characters into the string to get it to wrap to the next line. If I find anything else out on this, I'll post it in here.
Regards,

Michael Williams

Actuate Corporation – The BIRT Company™

If you need help with deploying BIRT and didn't find your answer here, check out the new Deployment Center.
 
Find me on:
Twitter
Facebook
Blog

LinkedIn
 
Email me:
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com

#3 Mylsamy

Mylsamy

    Junior Member

  • Members
  • PipPipPip
  • 33 posts

Posted 13 June 2010 - 07:08 PM

Thanks for your valuable reply Williams,

Now i found the solutions for word wrap. I call javascript method wrap(), that method i defined and now okay.

But the problem is starting here, when i view the report in Report viewer it display the output in HTML and PDF format. The same report i run through servlet means it display wrap() that is javascript method is not defined error.

Error : Unable to load Script file WebContent/scripts/WordWrap.js.

Error : A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: ReferenceError: "wrap" is not defined. I attached my report design file and PrintResume XML file.


My Javascript code is : WordWrap.js

function wrap(longStr,width){
length = longStr.length;
if(length <= width)
return longStr;
return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width));
}


Can i add any jar files to my Project? or How can i solve this problem?
Thanks in Advance

Myl

#4 pratim

pratim

    Junior Member

  • Members
  • PipPipPip
  • 34 posts

Posted 02 June 2011 - 03:03 AM

Hi,
Did you able to get rid of the exception, even i am seeing the exception when i try to do 'export data' to CSV format, from this report [which is deployed under tomcat server].
However i did not see any exception, if i do export data from BIRT eclipse setup.

Any help !!

#5 garyxue

garyxue

    Junior Member

  • Members
  • PipPip
  • 13 posts

Posted 20 September 2011 - 09:47 AM

Here is one solution. Put your content in a dynamic text item with the following text:

<div style="word-wrap: break-word"><VALUE-OF>row["longStr"]</VALUE-OF></div>

This works in both IE and Firefox, which supports the non-standard "word-wrap: break-word" style. Not sure about other browsers though.

#6 A.ASIKRAJA

A.ASIKRAJA

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 22 February 2013 - 02:23 AM

Hi,
If it is table data then select that data and select the propertis ->General Tab -> whitespace set to Normal.
Just try it.



Hi all,

I am using Birt report version 2.3.2.

I created a design in JDBC datasource and access the data.

and the dataset value is dateSetRow["CompnayName"]="sdssssssssssssssssssssssssssssssssssddddddfsfsfdsfdsfsdfsdfdsssssssssssssssssssss" like this.

I display the character is one line with out break the word when i view the report.

But i want to apply the Word wrap to that column.

Can I do this?

Please help me.



#7 deepakrkgi

deepakrkgi

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 30 April 2013 - 02:01 AM

hi myl

for word wrap in birt .. double click on data (data in table like email_Id).. on popup window ckick on
fx of expression column. Copy and paste following code
change EMAIL_ID to ur dataSetRow name

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["EMAIL_ID"], 15 );
  • A.ASIKRAJA likes this