officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-contentcontrolcollection-dot-insertcomboboxcontrol-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-documentposition-x29.md
Inserts a combo box content control at the specified document position.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
ContentControlComboBox InsertComboBoxControl(
DocumentPosition position
)
Function InsertComboBoxControl(
position As DocumentPosition
) As ContentControlComboBox
| Name | Type | Description |
|---|---|---|
| position | DocumentPosition |
The document position where the content control should be located.
|
| Type | Description |
|---|---|
| ContentControlComboBox |
The combo box content control.
|
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");
}
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Using wordProcessor = New RichEditDocumentServer()
Dim document As Document = wordProcessor.Document
Dim contentControls = document.ContentControls
Dim comboBoxPosition = document.CreatePosition(document.Paragraphs(2).Range.End.ToInt() - 1)
Dim 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")
End Using
See Also
ContentControlCollection Interface