delete all shapes in a footer

I

Igor

Hello,

Is there a way to delete all shapes of a certain type in the footer for all
pages?

Thanks,
Igor
 
C

Cindy M.

Hi Igor,
Is there a way to delete all shapes of a certain type in the footer for all
pages?

Possibly, but without more information (like, which type? And which version of
Word?) it's not possible to say for sure.

Most likely, it would involve looping (for...each) the Shape collection of the
footer, querying its Type property, then adding that Shape to an array. After
checking each shape, loop the array and delete each member.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
I

Igor

Hi Cindy,

There are many shapes that I am trying to delete in a file that was
originally converted from DOT to DOTX using Word 2007/ VS 2008. There are
many shapes in this footer because the shape represents boxes for persons to
hand write in letters after printing the document, so there is a rectangle
and about 6 lines.

The problem is, when I was trying to count all the shapes on the page, only
new test shapes that I created were being counted, not the ones in the
footer.

To fix this problem, I would either have to draw those shapes on the fly
(hence my other post) or figure out a way to remove them.

I like the border idea and will see if I can mimic these boxes with small
tables and borders. but manipulating the shapes would be ideal solution.
 
C

Cindy M.

Hi Igor,
The problem is, when I was trying to count all the shapes on the page, only
new test shapes that I created were being counted, not the ones in the
footer.

Ah, I think I may know the problem, then. You have to specifically address the
Footer range - it's a separate "story range" from the rest of the document.
Something along these lines:

Word.Footer ft = theDoc.Sections[1].Footers
[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary];

foreach (Word.Shape shp in ft.Shapes)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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