Skip to main content
All docs
V24.1

ContentControlCollection.InsertDatePickerControl(DocumentPosition) Method

Creates a date picker content control at the specified document position.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

ContentControlDate InsertDatePickerControl(
    DocumentPosition position
)

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:

date picker in word processing

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 });
}

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.

See Also