Word Tab and indent positions bug

A

Adrian Leeming

I might be wrong but I think Microsoft may have changed they way they convert
and round Centimeters to points in Microsoft Word or a change to tabbing
behaviour. They are also inconsistent on it and I did not think they used to
be. Allow me to explain

if you set an indent position at 1.5cm this gives a left indent of 42.55
points, which is a little odd rounding especially if you look at figures
genarted for positions around that point.
If you set an indent position at 3 cm it gives a left indent of 85.05
if you set default tab stops to 1.5cm then you get tabs at 42.55 and 85.1
This means that from a 3cm indent you press ctrl-tab and you get a HIDDEN
TAB, this has to be a bug and is now on 2003 and 2007.

However I would like to know does anyone know how Word calculates the 42.55
indent and the 85.05 as I need to match Word when generating indents as I end
up with 42.5 by rounding to the nearest twip (0.05 point) so end up
with a similiar problem to the one Word gets at 3cm on 1.5cm and I don't get
how it calculates the figures it uses.

Thank you Adrian.
 
D

Doug Robbins - Word MVP on news.microsoft.com

I think the following information provided by fellow MVP Jonathon West may
give you a clue of what is happening:

Quote

The reason for this is that while the Height and other properties
representing dimensions are presented as Single values of points, internally
they are stored as Integer values of twips (1/20th of a point).

This is the reason Word's page size cannot be larger than about 22", it is
2^15 twips.

So when you provide a Single value to the Height property of an object, Word
is converting to twips when saving, and looks like it it is rounding down to
the nearest lower whole number of twips.

You may remember the SelInfo property back in the days of WordBasic, the
various values of the SelInfo function returned dimensions in twips. It has
been replaced with the Selection.Information property, which does returns
equivalent values in points In fact, Word's help has never been updated to
correct this. The Word 2003 help does in fact still say the following

"wdHorizontalPositionRelativeToPage
Returns the horizontal position of the specified selection or range; this is
the distance from the left edge of the selection or range to the left edge
of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If
the selection or range isn't within the screen area, returns - 1."

UnQuote
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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