DeleteHeaderFooterShapes

Section.DeleteHeaderFooterShapes method

Löscht alle Formen (Zeichenobjekte) aus den Kopf- und Fußzeilen dieses Abschnitts.

public void DeleteHeaderFooterShapes()

Beispiele

Zeigt, wie alle Formen aus allen Kopf- und Fußzeilen in einem Abschnitt entfernt werden.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Erstelle einen primären Header mit einer Form.
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.InsertShape(ShapeType.Rectangle, 100, 100);

// Erstelle eine primäre Fußzeile mit einem Bild.
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.InsertImage(ImageDir + "Logo Icon.ico");

Assert.AreEqual(1, doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderPrimary].GetChildNodes(NodeType.Shape, true).Count);
Assert.AreEqual(1, doc.FirstSection.HeadersFooters[HeaderFooterType.FooterPrimary].GetChildNodes(NodeType.Shape, true).Count);

// Alle Formen aus den Kopf- und Fußzeilen im ersten Abschnitt entfernen.
doc.FirstSection.DeleteHeaderFooterShapes();

Assert.AreEqual(0, doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderPrimary].GetChildNodes(NodeType.Shape, true).Count);
Assert.AreEqual(0, doc.FirstSection.HeadersFooters[HeaderFooterType.FooterPrimary].GetChildNodes(NodeType.Shape, true).Count);

Siehe auch