Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Paragraph Class

Represents a single paragraph in a document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v19.1.Core.dll


public abstract class Paragraph


All paragraphs in a document are represented by the ParagraphCollection, accessible via the SubDocument.Paragraphs property. A document Section contains a collection of paragraphs and provides the Section.Paragraphs property to access it.

To modify formatting for a paragraph which encompasses the specified range, get a SubDocument interface for this range first. For this purpose, you can use the DocumentPosition.BeginUpdateDocument - DocumentPosition.EndUpdateDocument or the DocumentRange.BeginUpdateDocument - DocumentRange.EndUpdateDocument method pairs.

Then, use the SubDocument.BeginUpdateParagraphs - SubDocument.EndUpdateParagraphs paired methods. The SubDocument.BeginUpdateParagraphs method requires a DocumentRange as the parameter, and returns a ParagraphProperties interface which exposes formatting properties for this range.

To modify the text of the paragraph, you can use its SubDocument methods. For example, to append a text to the current paragraph, use the technique illustrated below.

The following code snippet appends text to the end of the current paragraph. Note that the DocumentPosition.BeginUpdateDocument call is required for proper operation within header/footer since it returns a SubDocument interface.

document.AppendText("First Paragraph" & vbLf & "Second Paragraph" & vbLf & "Third Paragraph")
Dim pos As DocumentPosition = document.CaretPosition
Dim doc As SubDocument = pos.BeginUpdateDocument()
Dim par As Paragraph = doc.Paragraphs.Get(pos)
Dim newPos As DocumentPosition = doc.CreatePosition(par.Range.End.ToInt() - 1)
doc.InsertText(newPos, "<<Appended to Paragraph End>>")

The following code snippets (auto-collected from DevExpress Examples) contain references to the Paragraph class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also