Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Birt word wrap(Birt word wrap)
Birt word wrap [message #526529] Mon, 12 April 2010 08:00 Go to next message
Wael Mashal is currently offline Wael MashalFriend
Messages: 10
Registered: January 2010
Junior Member
Hi all

if i have a long string without spaces to view it ,no wrap word work

for example this text "1234567891012345678910123456789101234567891012345678910"

i need to wrap it without spaces like this

"1234567891012345678910
1234567891012345678910
12345678910"

i write a script but the result returned with spaces

"1234567891012345678910123 4567891012345678910123456 78910"


this is the script :

len = "1234567891012345678910123456789101234567891012345678910".length; //gets
length of unbroken string
lines = Math.ceil(len/25); //counts the amount of times you'll have to use the
substr() function
i=1; //initialize line counter
marker = 0; //initialize placeholder
display = ""; //initialize output
//step through the string breaking it up with 25 character segments and adding
a space between segments
while (i<lines){
display = display + "\r" +
"1234567891012345678910123456789101234567891012345678910".substr(marker, 25);
marker = marker + 25;
i++;
}
//use the len variable and marker variable to determine how much is left and
add it to the output variable
display = display + "\r" +
"1234567891012345678910123456789101234567891012345678910".substr(marker,
len-marker);
//output the broken string
display;
Re: Birt word wrap [message #526596 is a reply to message #526529] Mon, 12 April 2010 11:56 Go to previous message
Wael Mashal is currently offline Wael MashalFriend
Messages: 10
Registered: January 2010
Junior Member
thanks all i find the solution

if ("1234567891012345678910123456789101234567891012345678910".length > 25) {
length = "123456789101234567891012345 6789101234567891012345678910".length;
"123456789101234567891012345 6789101234567891012345678910".substr(0, 25) + "\u200B" +
"123456789101234567891012345 6789101234567891012345678910".substring(25, length);
} else {
"1234567891012345678910123456789101234567891012345678910";
}
Previous Topic:[Chart] repeating label on X-axis
Next Topic:Empty flat files
Goto Forum:
  


Current Time: Fri Apr 26 11:05:06 GMT 2024

Powered by FUDForum. Page generated in 0.03587 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top