View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] baobob@my-deja.com is offline
external usenet poster
 
Posts: 100
Default How do you x-late GetTextExtentPoint32's units into the real world?

I know this gets asked regularly, but:

I've got a couple of text-centering and -wrapping demands that Excel
can't do automatically.

Exactly what do the units returned by GetTextExtentPoint32, and how do
you translate, convert, or otherwise use them to determine whether a
string fits horizontally inside a cell--taking into account font size
and attributes, screen resolution, etc.?

The best I can do now is to use an arbitrary conversion factor (which
varies between about 7.5-9.0, depending on column width)--and it STILL
returns the wrong result when I port the workbook to another system.

***

(One of my applications is: I have rows holding text in the first cell
of each row, with no blank rows separating each row of text. So I need
to wrap the text in each first cell, and indent the left side of the
second-and-on wrapped lines by say 3 spaces, leaving only the first
line out-dented. Maybe there's an easier way to do that than
programmatically?)

Thanks much.

***