Discussion:
delete all shapes in a footer
(too old to reply)
Igor
2009-05-29 19:58:02 UTC
Permalink
Hello,

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

Thanks,
Igor
Cindy M.
2009-05-31 07:52:54 UTC
Permalink
Hi Igor,
Post by 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 :-)
Igor
2009-06-01 05:15:21 UTC
Permalink
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.
Post by Cindy M.
Hi Igor,
Post by 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 :-)
Cindy M.
2009-06-02 08:58:36 UTC
Permalink
Hi Igor,
Post by 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 :-)

Continue reading on narkive:
Loading...