Dynamically change width according to data length

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?
 
M

Marshall Barton

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
 
W

Winshent

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top