Dynamically change width according to data length

  • Thread starter Thread starter Winshent
  • Start date Start date
W

Winshent

I have a base report which has text controls txt1 - txt10. Code
rerwites the query def.. so that in theory the report will display any
query. After the query def is set, the control sources of each text
control is set based on what the query contains.

I want to be able to dynamically change the width of the text boxes
according to what is in the data. Currently i am finding the max len of
the data in any given column and then modifying the textcontrol width
accordingly. However, uppercase and lowercase charachters take up
different amounts of space. Is it possible to adjust the width
according to space actually used?
 
Winshent said:
I have a base report which has text controls txt1 - txt10. Code
rerwites the query def.. so that in theory the report will display any
query. After the query def is set, the control sources of each text
control is set based on what the query contains.

I want to be able to dynamically change the width of the text boxes
according to what is in the data. Currently i am finding the max len of
the data in any given column and then modifying the textcontrol width
accordingly. However, uppercase and lowercase charachters take up
different amounts of space. Is it possible to adjust the width
according to space actually used?


If all the text in each text box fits on one line, you can
use the report's TextWidth method in conjunction with
several report properties (Font, FontSize, FontBold, etc).

If the text might be wrapped to more than one line, then use
the TextHeightWidth code at www.lebans.com
 
ok, thanks i will give that a try. I was looking at using monotype
fonts which is the other alternative.. but CourierNew doesnt look great
on a report and cant find a list of the others that are monotype.
 
Back
Top