Originally Posted By: Jean-Cédric
That worked for me!!! wink

Code:
MoveTo(0,0)
MoveTo(&Width,&Height)
Define(&LocalVariable,string,@(1,1,200))
Set(&LocalVariable,@(1,1,200))
define(&i,measure,20)
define(&lineWidth,measure,0)
define(&widthFound,boolean,false)

Margin(0.0000,0.0000)

%Loop through your data text on each encounter of ||
search(&LocalVariable,'||')
    &widthFound := false
    %Loop until a proper font size is found
    repeat
          setstyleext(&style1,&i,0,[100],100)
          if(stringwidth(&LocalVariable) > &width)
             &i := &i - 0.1
          else()
             &widthFound := true
          endif()
    until(&widthFound)

    BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
           setstyleext(&style1,&i,0,[100],100)
           Show(&LocalVariable)
    EndParagraph()
endsearch()

%repeat one more time as the variable &LocalVariable still contains the rest of the text after the last ||
&widthFound := false
repeat
      setstyleext(&style1,&i,0,[100],100)
      if(stringwidth(&LocalVariable) > &width)
         &i := &i - 0.1
      else()
         &widthFound := true
      endif()
until(&widthFound)

BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
       setstyleext(&style1,&i,0,[100],100)
       Show(&LocalVariable)
EndParagraph()



Wooow.. that just killed me:)

I tried this but it made whole thing huge, tried to fix it but its just impossible.

My code above works ok, I decided to add some string length variable to actual data file so it changes styles when its too long and makes it all small font.

However, I have problem with wrapping.
BeginParagraph wrapping works but cuts all words that come to right edge.
I only want to cut words that are very long without space - my data has sometimes http links, which can be very long. Ideal would be to cut those that have like 5 "/", but I guess I just ask too much:)
Maybe I just add space after each slash...