StoryAppendParagraph Method

A shortcut method that creates a Paragraph object with optional text and appends it to the end of this object.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Paragraph AppendParagraph(
	string text
)

Parameters

text
Type: SystemString
The text for the paragraph. Can be null or empty string.

Return Value

Type: Paragraph
The newly created and appended paragraph.
Examples
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");
See Also