[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] How to relate the length of a string to the amountof space used



Kevin,

As I posted about a week ago, I wrote an SQR library that handles this and many 
other situations.  I 
have not made it publicly available on our website since I may decide to sell 
something some day, 
but I am willing to give away copies (that you can use forever) to a few people 
to help them solve 
their problems.

You would be able to replace
"print $title () wrap #wrap 4 keep-top"
  with
"do wrap($title, #wrap, 0, 0)"
and it will handle the proportional font.

Hope this helps,
Eric


Kevin Laroche wrote:

> Hi Brio users
> I use the columns feature to set printing positions for labels in a report.
> I am trying to have column titles in a report automatically wrapped
> if they are too long  by storing the label and the space available to print 
>it in an 
> array called headers. It works but
> the titles wrap well before the line marking the start of the next column.
> I think this is because, for a proportional font, you may need 
> less than 20 spaces to print 20 letters.
> How can I relate the length of a string to the space required to print it?
> 
> 
> create-array
>   name=headers
>   size={max_rows}
>   field=titles:char   !labels go here
>   field=wrap:number   !this is supposed to be the amount of space available 
>to print
> 
> ~more code here
>   let #i = 2
>   while #i <= {no_columns}
> !--- this line is supposed to yield the amount of space available to print
>      let headers.wrap(#i - 1) = col.umn(#i) - col.umn(#i - 1) - 1
> !--where the col array is the numeric values of the columns I have set up
>      let $label = headers.titles(#i)
>      let #wrap =  headers.wrap(#i - 1)
>      let #i = #i + 1
>   end-while
> 
> ~more code here, another while loop
> !time to print the labels
>  use-column #i
>   let $title = headers.titles(#i)
>   let #wrap  = headers.wrap(#i)
>   print $title () wrap #wrap 4 keep-top
> 
> Hope my question is short and clear!
> 
> Thanks
> 
> 
> Kevin LaRoche
> Ottawa, Ontario
> Brio 6.1 Oracle 8i Windows 2000
> 
> 
> 
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users