Back to Devexpress

Paragraph.Range Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-paragraph-71961df3.md

latest5.9 KB
Original Source

Paragraph.Range Property

Gets the document range occupied by the current paragraph.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public abstract DocumentRange Range { get; }
vb
Public MustOverride ReadOnly Property Range As DocumentRange

Property Value

TypeDescription
DocumentRange

A DocumentRange interface.

|

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

Note

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.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Comments.cs#L11

csharp
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
DocumentRange docRange = document.Paragraphs[2].Range;
string commentAuthor = "Johnson Alphonso D";

word-document-api-examples/CS/CodeExamples/CommentsActions.cs#L32

csharp
// Access the range of the third paragraph.
DocumentRange docRange = document.Paragraphs[2].Range;

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/FormattingActions.cs#L15

csharp
document.EndUpdate();
DocumentRange range = document.Paragraphs[1].Range;
CharacterProperties cp = document.BeginUpdateCharacters(range);

winforms-rich-edit-text-formatting/CS/Text Formatting Example/Form1.cs#L45

csharp
//The target range is the first paragraph
DocumentRange range = document.Paragraphs[0].Range;

winforms-richedit-table-of-contents-practical-guide/CS/Form1.cs#L64

csharp
Document.Fields.Create(location, string.Format("TC \"{0}\" \\f {1} \\l {2}",
        Document.GetText(Document.Paragraphs.Get(location).Range), "defaultGroup", level));
});

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Comments.vb#L11

vb
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
Dim docRange As DevExpress.XtraRichEdit.API.Native.DocumentRange = document.Paragraphs(CInt((2))).Range
Dim commentAuthor As String = "Johnson Alphonso D"

word-document-api-examples/VB/CodeExamples/FormattingActions.vb#L31

vb
' Access the range of the document's second paragraph.
Dim range As DevExpress.XtraRichEdit.API.Native.DocumentRange = document.Paragraphs(CInt((1))).Range
' Start to modify character formatting of the target range.

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/FormattingActions.vb#L12

vb
document.EndUpdate()
Dim range As DocumentRange = document.Paragraphs(1).Range
Dim cp As CharacterProperties = document.BeginUpdateCharacters(range)

winforms-rich-edit-text-formatting/VB/Text Formatting Example/Form1.vb#L42

vb
'The target range is the first paragraph
Dim range As DocumentRange = document.Paragraphs(0).Range

winforms-richedit-table-of-contents-practical-guide/VB/Form1.vb#L66

vb
Private Sub AddTCFields()
    SearchForTOCEntries(Sub(ByVal location, ByVal level) Document.Fields.Create(location, String.Format("TC ""{0}"" \f {1} \l {2}", Document.GetText(Document.Paragraphs.Get(location).Range), "defaultGroup", level)))
End Sub

See Also

Paragraph Class

Paragraph Members

DevExpress.XtraRichEdit.API.Native Namespace