ParagraphParentStory Property

Retrieves the parent section-level story that can be Body or HeaderFooter.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public Story ParentStory { get; }

Property Value

Type: Story

ExpandedExamples

Creates a header and footer using the document object model and insert them into a section.
Document doc = new Document();

HeaderFooter header = new HeaderFooter(doc, HeaderFooterType.HeaderPrimary);
doc.FirstSection.HeadersFooters.Add(header);

// Add a paragraph with text to the footer
Paragraph para = header.AppendParagraph("My header");

Assert.True(header.IsHeader);
Assert.True(para.IsEndOfHeaderFooter);

HeaderFooter footer = new HeaderFooter(doc, HeaderFooterType.FooterPrimary);
doc.FirstSection.HeadersFooters.Add(footer);

// Add a paragraph with text to the footer
para = footer.AppendParagraph("My footer");

Assert.False(footer.IsHeader);
Assert.True(para.IsEndOfHeaderFooter);

Assert.AreEqual(footer, para.ParentStory);
Assert.AreEqual(footer.ParentSection, para.ParentSection);
Assert.AreEqual(footer.ParentSection, header.ParentSection);

doc.Save(ArtifactsDir + "HeaderFooter.HeaderFooterCreate.docx");

ExpandedSee Also