Discussion:
Shape positioning
(too old to reply)
Ferass Elrayes
2008-03-14 13:59:00 UTC
Permalink
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
2008-03-14 16:59:13 UTC
Permalink
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.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Ferass Elrayes
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.
f***@net-centric.com
2008-03-14 17:40:21 UTC
Permalink
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
Post by Jonathan West
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.
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Ferass Elrayes
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.- Hide quoted text -
- Show quoted text -
Jonathan West
2008-03-14 22:02:11 UTC
Permalink
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
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

<***@net-centric.com> wrote in message news:3c1c5b37-7cd9-4d29-acc8-***@s12g2000prg.googlegroups.com...
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
Post by Jonathan West
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.
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Ferass Elrayes
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.- Hide quoted text -
- Show quoted text -
f***@net-centric.com
2008-03-15 12:28:35 UTC
Permalink
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
Post by Jonathan West
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
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Hi Jonathan,
    Thanks for taking the time to reply.
"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 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
Post by Jonathan West
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.
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Ferass Elrayes
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.- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
Jonathan West
2008-03-15 13:10:38 UTC
Permalink
Is the anchor within a table cell?
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


<***@net-centric.com> wrote in message news:a94684ff-247e-450e-886d-***@s13g2000prd.googlegroups.com...
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
Post by Jonathan West
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
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Hi Jonathan,
Thanks for taking the time to reply.
"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 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
Post by Jonathan West
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.
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Ferass Elrayes
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.- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
f***@net-centric.com
2008-03-15 13:50:06 UTC
Permalink
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
Post by Jonathan West
Is the anchor within a table cell?
--
Regards
Jonathan West - Word MVPwww.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
Post by Jonathan West
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
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Hi Jonathan,
Thanks for taking the time to reply.
"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 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
Post by Jonathan West
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.
--
Regards
Jonathan West - Word MVPwww.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Ferass Elrayes
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.- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
Loading...