How can I determine if a Shape is in front of or behind the document?

J

Ji Zhou

Hello Dave,

The ZorderPosistion is used to decide shapes' relative Z order position.
From your question, my understanding is we are trying to retrieve a property
that can indicates whether the Word shape is sent behind the document text,
right?

If that is the case, we can get the information from the
shape.WrapFormat.Type.

When the shape is sent front of the text, it is wdWrapFront. When the shape
is sent back of the text, it is wdWrapBehind.

http://msdn.microsoft.com/en-us/library/bb214041.aspx

Hope this helps and have a nice day!

Best regards,
Ji Zhou
Microsoft Online Community Support
 
D

David Thielen

Hi;

I get wdWrapNone when it is set to inFront or behind. Is there
something else I should be doing on this? I am using Word 2007 SP2.

thanks - dave


Hello Dave,

The ZorderPosistion is used to decide shapes' relative Z order position.
From your question, my understanding is we are trying to retrieve a property
that can indicates whether the Word shape is sent behind the document text,
right?

If that is the case, we can get the information from the
shape.WrapFormat.Type.

When the shape is sent front of the text, it is wdWrapFront. When the shape
is sent back of the text, it is wdWrapBehind.

http://msdn.microsoft.com/en-us/library/bb214041.aspx

Hope this helps and have a nice day!

Best regards,
Ji Zhou
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
C

Colbert Zhou [MSFT]

Hello Dave,

This should be the only way to know the information about the shape's wrap
type. Actually, I am also testing in Word 2007 SP2. But it works for me. I
have created a test document, you can download it from,
http://cid-c2e0d62e8a095a30.skydrive.live.com/self.aspx/Public/Test.docm

When we open the document, the document behind Macro gets executed. We will
see two message box, 3 and 5. The first 3 is the wrap type for the shape1
and second 5 is the wrap type for the shape2.(3 is wdWrapNone and
wdWrapFront, 5 is wdWrapBehind)

public enum WdWrapType
{
wdWrapBehind = 5,
wdWrapFront = 3,
wdWrapInline = 7,
wdWrapNone = 3,
wdWrapSquare = 0,
wdWrapThrough = 2,
wdWrapTight = 1,
wdWrapTopBottom = 4
}

Could you please download my Test.docm file and give it a test?

Best regards,
Ji Zhou
Microsoft Online Community Support
 
D

David Thielen

Hi;

Your example does work correctly - in my code too. But please take a
look at the file in http://www.windwardreports.com/temp/pic-behind.zip
- it does not work. The image is behind but the wrap is wdWrapNone.

??? - thanks - dave


Hello Dave,

This should be the only way to know the information about the shape's wrap
type. Actually, I am also testing in Word 2007 SP2. But it works for me. I
have created a test document, you can download it from,
http://cid-c2e0d62e8a095a30.skydrive.live.com/self.aspx/Public/Test.docm

When we open the document, the document behind Macro gets executed. We will
see two message box, 3 and 5. The first 3 is the wrap type for the shape1
and second 5 is the wrap type for the shape2.(3 is wdWrapNone and
wdWrapFront, 5 is wdWrapBehind)

public enum WdWrapType
{
wdWrapBehind = 5,
wdWrapFront = 3,
wdWrapInline = 7,
wdWrapNone = 3,
wdWrapSquare = 0,
wdWrapThrough = 2,
wdWrapTight = 1,
wdWrapTopBottom = 4
}

Could you please download my Test.docm file and give it a test?

Best regards,
Ji Zhou
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
C

Colbert Zhou [MSFT]

Hello Dave,

Thanks for the sample document. Now I can reproduce the issue under Word
2007 SP2. Actually, I also test in Word 2010 RTM and it works in 2010. This
probably is a bug for Word 2007. It does not differentiate the wdWrapBehind
and wdWrapFront for all Picture type shape, but other types work fine. I do
a lot of debugging on this, but haven't found an alternative property to
replce the WrapFormat.Type yet. So I am afraid there is not an easy
solution for this. I will submit the issue internally. Hope the PG can fix
this in future.

Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support
 
D

David Thielen

Please ask them how we can determine this - we have to as otherwise we
will always be moving a BEHIND image to INFRONT. This is killer for
us.

thanks - dave


Hello Dave,

Thanks for the sample document. Now I can reproduce the issue under Word
2007 SP2. Actually, I also test in Word 2010 RTM and it works in 2010. This
probably is a bug for Word 2007. It does not differentiate the wdWrapBehind
and wdWrapFront for all Picture type shape, but other types work fine. I do
a lot of debugging on this, but haven't found an alternative property to
replce the WrapFormat.Type yet. So I am afraid there is not an easy
solution for this. I will submit the issue internally. Hope the PG can fix
this in future.

Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

Ji Zhou

Hello Dave,

Based on a few more days investigations and consulting results, I think I
can say, if the CommandBarButton state workaround(as I mentioned in emails)
does not work for your scenario, we have to wait for the bug fixed in
further Word 2007 Service pack. Product group has logged this and it will be
considered to be fixed in future sp.

If there is anything else I can provide on this issue, just let me know and
I will try my best to follow up.

Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support
 
D

David Thielen

Bummer - ok.

Hello Dave,

Based on a few more days investigations and consulting results, I think I
can say, if the CommandBarButton state workaround(as I mentioned in emails)
does not work for your scenario, we have to wait for the bug fixed in
further Word 2007 Service pack. Product group has logged this and it will be
considered to be fixed in future sp.

If there is anything else I can provide on this issue, just let me know and
I will try my best to follow up.

Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 

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