FieldCollection.Create(DocumentPosition, String) Method
Adds a field specified by its code to the field collection.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v20.1.Core.dll
NuGet Package: DevExpress.RichEdit.Core
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.WindowsDesktop.RichEdit.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
start | DocumentPosition | A DocumentPosition at which the field is inserted. |
code | String | A string specifying the field’s code. |
Returns
Type | Description |
---|---|
Field | A Field object specifying the newly created field. |
Remarks
Use the Create method to insert a new field in a document.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/word-processing-document-api-examples-t418535
Document document = server.Document;
document.BeginUpdate();
document.Fields.Create(document.Range.Start, "DATE");
document.Fields.Update();
document.EndUpdate();
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Create(DocumentPosition, String) 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.