Add Picture in Word 2K to Header with Table

W

Ward

Hi,

I am trying to add a Logo to an Header in an template. Positioning with
..Left and .Right works fine. But not when there is a Table in the Header.
Then Word does not use the RelativeHorizontal(&Vertical)PositionPage
correctly. With an table in the Header, Word will position the Picture
against the upper left corner of the Table. And I am not allowed to remove
the table...
Is there a work-around?

Thanks

PS: i use the following code (i removed the part for the different Header
types and the Section part for your convenience...)

Set myShape = mySection.Headers(wdHeaderFooterPrimary).Shapes.AddPicture( _
FileName:=strLogoFullName)

With myShape
.LockAspectRatio = True
.ZOrder msoSendBehindText
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = wdRelativeHorizontalPositionPage
.Left = CentimetersToPoints(1)
.Top = CentimetersToPoints(1)
.Width = CentimetersToPoints(5)
End with
 
J

Jean-Guy Marcil

Ward was telling us:
Ward nous racontait que :
Hi,

I am trying to add a Logo to an Header in an template. Positioning
with .Left and .Right works fine. But not when there is a Table in
the Header. Then Word does not use the
RelativeHorizontal(&Vertical)PositionPage correctly. With an table in
the Header, Word will position the Picture against the upper left
corner of the Table. And I am not allowed to remove the table...
Is there a work-around?

Thanks

PS: i use the following code (i removed the part for the different
Header types and the Section part for your convenience...)

Set myShape =
mySection.Headers(wdHeaderFooterPrimary).Shapes.AddPicture( _
FileName:=strLogoFullName)

With myShape
.LockAspectRatio = True
.ZOrder msoSendBehindText
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = wdRelativeHorizontalPositionPage
.Left = CentimetersToPoints(1)
.Top = CentimetersToPoints(1)
.Width = CentimetersToPoints(5)
End with

Make sure the picture is not anchored to a paragraph that is inside the
table, or use an InlineShape.
 
W

Ward

Thank you for your answer Jean-Guy.
I think you are right on the spot. (Although by default the object should be
Anchored to the page, not the paragraph.) I think that my problem is that the
total header is one table, and i don't know how i can anchor the Shape to the
Page and not to the paragraph in the tabel. Do you have an idea?

Thanx, Ward
 
J

Jean-Guy Marcil

Ward was telling us:
Ward nous racontait que :
Thank you for your answer Jean-Guy.
I think you are right on the spot. (Although by default the object
should be Anchored to the page, not the paragraph.) I think that my
problem is that the total header is one table, and i don't know how i
can anchor the Shape to the Page and not to the paragraph in the
tabel. Do you have an idea?

An object is always anchored to a paragraph, never to the"page."
This paragraph maybe inside a table or not.

Insert a paragraph mark before the table (You may need to position the
cursor in the first row and do "Table" menu > Split Table)
You might want to make it 1 point in size so as to make it practically
invisible.

Then, when you insert the graphic, make sure you use that paragraph as a
range for anchoring.

Note that you could anchor the graphic to a paragraph inside the table and
get it to behave as you want, but that takes some doing... You have to play
with "Lock anchor" and "Layout in table cell" in the "Picture Position" of
the "Advanced Layout" options of the "Layout" tab on the Picture format
dialogue... And Word has that nasty habit of resetting the "Layout in table
cell" option when you manually try to adjust the graphic position...

However, if you position it exactly where you want it with code, you should
not need to play with the graphic manually, right?
 
W

Ward

Yes Ofcource! I added a small paragraph mark outside the table. Problem solved!
Thanks for your help Jean-Guy.

(sorry for my late reaction: i had a small vacation ...)
 
J

Jean-Guy Marcil

Ward was telling us:
Ward nous racontait que :
Yes Ofcource! I added a small paragraph mark outside the table.
Problem solved! Thanks for your help Jean-Guy.

Glad I could help.
(sorry for my late reaction: i had a small vacation ...)

Well, good for you, that is better than having a small episode...
 

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