Re: converting points to centimeters...
- From: Sam <Sam@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 6 Jul 2005 09:09:05 -0700
Hi Jean-Guy
Thanks for that explanation. I suppose that Word's rounding to the nearest
hundredth of a point is necessary (it can't go to an infinite number of
decimal points), and Word's unfortunate points orientation is an evil we all
have to live with.
I'm not comfortable with the rounding because it's not controllable - it's
quite possible that a user may want a specific measurement that will be
unachievable because of the points-rounding and the results-rounding. But
that's life. You can't always get what you want.
I'm going to have to do the rounding manually in the code because the
solution has to be Word 97 compatible and I don't believe there's a Round
function or method available in 97.
Thanks again.
"Jean-Guy Marcil" wrote:
> Sam was telling us:
> Sam nous racontait que :
>
> > Hi Doug
> >
> > Thanks again for the suggestion. Unfortunately the Single variable
> > doesn't seem to help. I modified my code as below. The msgbox x
> > still returns
> > 1.250597. The problem seems to arise when the CentimetersToPoints
> > value is stored or when the setting is converted back - your code
> > works fine but it doesn't actually convert and store the value or
> > convert a stored value.
> >
> > Any ideas as to what's going on and how to fix it?
>
> I can tell you what is going wrong, but I am not sure about the fixing
> part..
>
> The problem is not the conversion itself, but the act that Word rounds the
> list value to the nearest 0.05 point.
>
> x = CentimetersToPoints(1.25)
>
> results in x being equal to 35.43307.
>
> But,
> Dim x As Single
> With lstListTemplate.ListLevels(1)
> x = .NumberPosition
> MsgBox x
> End With
>
> yields a value of 35.45, which once converted in cm is exactly 1.250597.
>
> If you try with
> x = 35.43307
> when setting up the list template you still end up with 35.45.
>
> No matter what I tried, I either ended up with 35.4 or 35.45.
>
> When you work with inches, it so happens that 1.25 inches is exactly 90
> points (1 inch = 72 points), so no rounding up occurs.
>
> If you do the whole thing by hand, you will only see 1.25 cm because Word
> does not allow/ignores the 3rd digit after the decimal point, so you would
> never see it as 1.250597.
>
> I do not think it can be fixed.
>
> I guess that it you round up the x in
> x = PointsToCentimeters(.NumberPosition)
> MsgBox x
> to 2 digits after the decimal point, the result will be OK anyway... so
> there isn't really a problem.
>
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@xxxxxxxxxxxxxxxxxxxxxxx
> Word MVP site: http://www.word.mvps.org
>
>
>
>
.
- References:
- converting points to centimeters...
- From: Sam
- Re: converting points to centimeters...
- From: Doug Robbins
- Re: converting points to centimeters...
- From: Sam
- Re: converting points to centimeters...
- From: Jean-Guy Marcil
- converting points to centimeters...
- Prev by Date: Formatting Dates
- Next by Date: Re: Copy from variant to clipboard
- Previous by thread: Re: converting points to centimeters...
- Next by thread: TextBox Text
- Index(es):
Relevant Pages
|