Fitting a Text Box to the Text

S

Stanley Wileman

I recently posted to the word.drawing-graphics group, and although I got a
response, it doesn't solve the problem I have.

Without going into the reasons why, I'm generating RTF to create an
invisible textbox with zero internal margins around some text. For example,
say the text is "WWW". Is there any reliable way to determine the minimum
text box width that'll enclose that text without clipping or wrapping taking
place? I've tried using the GetTextExtentPoint32 API, but there's always
some difference between its result and the minimum width that Word (2000 or
XP) will accept without wrapping the text. Obviously the width of the
textbox lines will affect things, but that's not everything that's going on.
Any clues where to look for illumination?

BTW, having Word dynamically resize things isn't acceptable, since I need to
know the textbox size so other drawing objects can be placed correctly
relative to it.

Thanks!

--Stan Wileman
 

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