StoryAppendParagraph Method |
Namespace: Aspose.Words
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");