The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Paragraph Class

Represents a single paragraph in a document.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

[ComVisible(true)]
public abstract class Paragraph
<ComVisible(True)>
Public MustInherit Class Paragraph
[ComVisible(true)]
public abstract class Paragraph
<ComVisible(True)>
Public MustInherit Class Paragraph

Remarks

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.BeginUpdate()
document.AppendText("First Paragraph" & vbLf & "Second Paragraph" & vbLf & "Third Paragraph")
document.EndUpdate()
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>>")
pos.EndUpdateDocument(doc)

Inheritance

Object
Paragraph
See Also