officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-4edb2252.md
A document paragraph.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
[ComVisible(true)]
public abstract class Paragraph
<ComVisible(True)>
Public MustInherit Class Paragraph
The following members return Paragraph objects:
The ParagraphCollection contains all document paragraphs. Use the SubDocument.Paragraphs property to access a specific paragraph by its index. The Section.Paragraphs property obtains a collection of paragraphs in a specific document section. Call the ReadOnlyParagraphCollection.Get method to retrieve a paragraph related to a specific range.
Yoy can format paragraphs directly or use document styles. Refer to the following topic for more examples on how to format paragraphs:
Read Tutorial: Text Formatting
The following snippet appends a paragraph and inserts a paragraph at the start of the second section:
using DevExpress.XtraRichEdit.API.Native;
using (var wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("FirstLook.docx");
Document document = wordProcessor.Document;
// Start the document update:
document.BeginUpdate();
// Append a paragraph:
Paragraph appendedParagraph = document.Paragraphs.Append();
document.InsertText(appendedParagraph.Range.Start, "Appended paragraph");
// Insert a paragraph at the start of the second section:
Paragraph paragraph =
document.Paragraphs.Insert(document.Sections[1].Range.Start);
DocumentPosition position =
document.Paragraphs[paragraph.Index - 1].Range.Start;
document.InsertText(position, "Inserted paragraph");
// Finalize the document update:
document.EndUpdate();
}
Imports DevExpress.XtraRichEdit.API.Native
Using wordProcessor = New RichEditDocumentServer()
wordProcessor.LoadDocument("FirstLook.docx")
Dim document As Document = wordProcessor.Document
' Start the document update:
document.BeginUpdate()
' Append a paragraph:
Dim appendedParagraph As Paragraph = document.Paragraphs.Append()
document.InsertText(appendedParagraph.Range.Start, "Appended paragraph")
' Insert a paragraph at the start of the second section:
Dim paragraph As Paragraph =
document.Paragraphs.Insert(document.Sections(1).Range.Start)
Dim position As DocumentPosition =
document.Paragraphs(paragraph.Index - 1).Range.Start
document.InsertText(position, "Inserted paragraph")
' Finalize the document update:
document.EndUpdate()
Object Paragraph
See Also