ContentControlCollection.InsertComboBoxControl(DocumentPosition) Method
Inserts a combo box 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
ContentControlComboBox InsertComboBoxControl(
DocumentPosition position
)
#Parameters
Name | Type | Description |
---|---|---|
position | Document |
The document position where the content control should be located. |
#Returns
Type | Description |
---|---|
Content |
The combo box content control. |
#Example
The code sample below creates a combo box:
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using (var wordProcessor = new RichEditDocumentServer()) {
Document document = wordProcessor.Document;
var contentControls = document.ContentControls;
var comboBoxPosition = document.CreatePosition(document.Paragraphs[2].Range.End.ToInt() - 1);
var comboBox = contentControls.InsertComboBoxControl(comboBoxPosition);
comboBox.AddItem("First Appointment", "First Appointment");
comboBox.AddItem("Follow-Up Appointment", "Follow-Up Appointment");
comboBox.AddItem("Laboratory Results Check", "Laboratory Results Check");
comboBox.SetText("Click to enter a type");
}