ContentControlCollection.InsertDatePickerControl(DocumentPosition) Method
Creates a date picker content control at the specified document position.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
position | DocumentPosition | The document position where the content control should be located. |
Returns
Type | Description |
---|---|
ContentControlDate | The date picker content control. |
Example
The code sample below creates a date picker control:
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using (var wordProcessor = new RichEditDocumentServer()){
wordProcessor.CreateNewDocument();
Document document = wordProcessor.Document;
var contentControls = document.ContentControls;
var datePicker = contentControls.InsertDatePickerControl(document.Range.Start);
datePicker.Date = DateTime.Now;
datePicker.DateFormat = "dddd, MMMM dd, yyyy";
datePicker.Color = System.Drawing.Color.RebeccaPurple;
wordProcessor.SaveDocument("Content Controls Date Picker.docx", DocumentFormat.OpenXml);
Process.Start(new ProcessStartInfo("Content Controls Date Picker.docx") { UseShellExecute = true });
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the InsertDatePickerControl(DocumentPosition) 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.