FieldCollection.Create(DocumentRange) Method
Creates a field from the specified range and adds it to the field collection.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
range | DocumentRange | A DocumentRange object specifying a range to be transformed to a field. |
Returns
Type | Description |
---|---|
Field | A Field object specifying the newly created field. |
Remarks
The Create method transforms the specified range to the field. The text content of the range becomes the code of the newly created field.
This code snippet creates a field from the selected range so that the selected text becomes the field code.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
document.BeginUpdate()
'Insert the text to the document end
document.AppendText("SYMBOL 0x54 \f Wingdings \s 24")
document.EndUpdate()
'Convert the inserted text to the field
document.Fields.Create(document.Paragraphs(0).Range)
document.Fields.Update()
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Create(DocumentRange) method.
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.