delete_header_footer_shapes method

delete_header_footer_shapes()

Deletes all shapes (drawing objects) from the headers and footers of this section.

def delete_header_footer_shapes(self):
    ...

Examples

Shows how to remove all shapes from all headers footers in a section.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Create a primary header with a shape.
builder.move_to_header_footer(aw.HeaderFooterType.HEADER_PRIMARY)
builder.insert_shape(aw.drawing.ShapeType.RECTANGLE, 100, 100)

# Create a primary footer with an image.
builder.move_to_header_footer(aw.HeaderFooterType.FOOTER_PRIMARY)
builder.insert_image(IMAGE_DIR + "Logo icon.ico")

self.assertEqual(1, doc.first_section.headers_footers.header_primary.get_child_nodes(aw.NodeType.SHAPE, True).count)
self.assertEqual(1, doc.first_section.headers_footers.footer_primary.get_child_nodes(aw.NodeType.SHAPE, True).count)

# Remove all shapes from the headers and footers in the first section.
doc.first_section.delete_header_footer_shapes()

self.assertEqual(0, doc.first_section.headers_footers.header_primary.get_child_nodes(aw.NodeType.SHAPE, True).count)
self.assertEqual(0, doc.first_section.headers_footers.footer_primary.get_child_nodes(aw.NodeType.SHAPE, True).count)

See Also