Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Shape positioning

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ferass Elrayes - 14 Mar 2008 14:59 GMT
Hello everyone,
I am working on a project that requires me to calculate the exact position
of shapes on a page (absolute position from the top left corner of the page).
Initially, I tried selecting the shape and using the get_information method
to retrieve this information but found that this returns the positon of the
anchor.
I couldn't establish a relation between that anchor and the top left corner
of the image.
I have a specific case when the anchor appears on the bottom left corner of
the image, the vertical positoning is 0 pt from the paragraph and horizontal
positioning is 0 pt from a column. In another case the anchor appears in the
top left corner of the image with the same parameters.

What are the factors affecting the positioning of the anchor?

Is there a reliable way to always obtain the absolute positon of the top
left corner of a shape?

Your help is much appreciated.
Jonathan West - 14 Mar 2008 17:59 GMT
Take a look at the Top and Left properties of the Shape object in VBA help.

The anchor is the position of the paragraph to which the shape is attached.
Every shape is anchored to a paragraph, either in the body of the document
or in a header or footer.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Hello everyone,
> I am working on a project that requires me to calculate the exact position
[quoted text clipped - 22 lines]
>
> Your help is much appreciated.
felrayes@net-centric.com - 14 Mar 2008 18:40 GMT
Hi Jonathan,
   Thanks for taking the time to reply.
The help for Top is :
"The position of a shape is measured from the upper-left corner of the
shape's bounding box to the shape's anchor. The
RelativeVerticalPosition property controls whether the shape's anchor
is positioned alongside the line, the paragraph, the margin, or the
edge of the page."
The help for Left is :
"The position of a shape is measured from the upper-left corner of the
shape's bounding box to the shape's anchor. The
RelativeHorizontalPosition property controls whether the anchor is
positioned alongside a character, column, margin, or the edge of the
page."

I am assuming that when the top value is 0, and the left value is 0
then the anchor should be placed in the top left corner of the shape.
I have documents that demonstrate this not to be the case.

I can upload one of these documents to you if you are interested.

I thank you again for your help.

Ferass

> Take a look at the Top and Left properties of the Shape object in VBA help.
>
[quoted text clipped - 35 lines]
>
> - Show quoted text -
Jonathan West - 14 Mar 2008 23:02 GMT
So proceed as follows.

- Read the RelativeVerticalPosition and RelativeHorizontalPosition and store
them somewhere.
- Set both the RelativeVerticalPosition and RelativeHorizontalPosition to be
relative to Page
- Read the Top and Left properties, which will now give you the position of
the shape relative to the top left corner of the page (in points)
- restore the original settings of RelativeVerticalPosition and
RelativeHorizontalPosition

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Hi Jonathan,
   Thanks for taking the time to reply.
The help for Top is :
"The position of a shape is measured from the upper-left corner of the
shape's bounding box to the shape's anchor. The
RelativeVerticalPosition property controls whether the shape's anchor
is positioned alongside the line, the paragraph, the margin, or the
edge of the page."
The help for Left is :
"The position of a shape is measured from the upper-left corner of the
shape's bounding box to the shape's anchor. The
RelativeHorizontalPosition property controls whether the anchor is
positioned alongside a character, column, margin, or the edge of the
page."

I am assuming that when the top value is 0, and the left value is 0
then the anchor should be placed in the top left corner of the shape.
I have documents that demonstrate this not to be the case.

I can upload one of these documents to you if you are interested.

I thank you again for your help.

Ferass

On Mar 14, 12:59 pm, "Jonathan West" <jw...@mvps.org> wrote:
> Take a look at the Top and Left properties of the Shape object in VBA
> help.
[quoted text clipped - 43 lines]
>
> - Show quoted text -
felrayes@net-centric.com - 15 Mar 2008 13:28 GMT
Thanks again for your help.
This works for many documents. But for the ones to which I was
referring where the anchor is positioned in the lower left corner of
the image, the coordinates are not correct.
Even when I try to change the alignment from Word (not
programatically), the value that appears in the absolute positon field
in the picture position tab of the advanced layout dialogue box is
incorrect and reflects what I am getting programatically.

Any other suggestions?

Thanks kindly,

Ferass

> So proceed as follows.
>
[quoted text clipped - 91 lines]
>
> - Show quoted text -
Jonathan West - 15 Mar 2008 14:10 GMT
Is the anchor within a table cell?

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Thanks again for your help.
This works for many documents. But for the ones to which I was
referring where the anchor is positioned in the lower left corner of
the image, the coordinates are not correct.
Even when I try to change the alignment from Word (not
programatically), the value that appears in the absolute positon field
in the picture position tab of the advanced layout dialogue box is
incorrect and reflects what I am getting programatically.

Any other suggestions?

Thanks kindly,

Ferass

On Mar 14, 6:02 pm, "Jonathan West" <jw...@mvps.org> wrote:
> So proceed as follows.
>
[quoted text clipped - 97 lines]
>
> - Show quoted text -
felrayes@net-centric.com - 15 Mar 2008 14:50 GMT
No, the anchor appears within the left margin.
I also have the "Move object with Text", "Allow overlap" and "Layout
in table cell" checked while the "Lock Anchor" is unchecked. The Text
Wrapping is "Top and Bottom".
Does the fact that the text wrapping is top and bottom and the height
of the image is larger than the distance from the anchor to the bottom
of the page affecting anything?

Thanks again Jonathan.

Ferass

> Is the anchor within a table cell?
>
[quoted text clipped - 126 lines]
>
> - Show quoted text -

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.