officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-formfieldcollection-dot-insertcheckbox-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-documentposition-x29.md
Inserts a CheckBox object at a given document position.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
CheckBox InsertCheckBox(
DocumentPosition position
)
Function InsertCheckBox(
position As DocumentPosition
) As CheckBox
| Name | Type | Description |
|---|---|---|
| position | DocumentPosition |
A DocumentPosition object that is the position within the document to place the checkbox.
|
| Type | Description |
|---|---|
| CheckBox |
A CheckBox object that is the target checkbox.
|
Note
Checkboxes cannot be inserted to the document header,footer, comment or floating objects (text boxes or shapes). Otherwise, an exception occurs.
DocumentPosition currentPosition = server.Document.Range.Start;
DevExpress.XtraRichEdit.API.Native.CheckBox checkBox = server.Document.FormFields.InsertCheckBox(currentPosition);
checkBox.Name = "check1";
checkBox.State = CheckBoxState.Checked;
checkBox.SizeMode = CheckBoxSizeMode.Auto;
checkBox.HelpTextType = FormFieldTextType.Custom;
checkBox.HelpText = "help text";
Dim currentPosition As DocumentPosition = server.Document.Range.Start
Dim checkBox As DevExpress.XtraRichEdit.API.Native.CheckBox = server.Document.FormFields.InsertCheckBox(currentPosition)
checkBox.Name = "check1"
checkBox.State = CheckBoxState.Checked
checkBox.SizeMode = CheckBoxSizeMode.Auto
checkBox.HelpTextType = FormFieldTextType.Custom
checkBox.HelpText = "help text"
The following code snippets (auto-collected from DevExpress Examples) contain references to the InsertCheckBox(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.
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/FormFields.cs#L18
SubDocument currentDocument = currentPosition.BeginUpdateDocument();
DevExpress.XtraRichEdit.API.Native.CheckBox checkBox = document.FormFields.InsertCheckBox(currentPosition);
checkBox.Name = "check1";
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/FormFieldsActions.cs#L16
DocumentPosition currentPosition = document.CaretPosition;
DevExpress.XtraRichEdit.API.Native.CheckBox checkBox = document.FormFields.InsertCheckBox(currentPosition);
checkBox.Name = "check1";
word-document-api-examples/CS/CodeExamples/FormFieldsActions.cs#L22
// Insert a checkbox at the specified position.
DevExpress.XtraRichEdit.API.Native.CheckBox checkBox = wordProcessor.Document.FormFields.InsertCheckBox(currentPosition);
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/FormFields.vb#L16
Dim currentDocument As DevExpress.XtraRichEdit.API.Native.SubDocument = currentPosition.BeginUpdateDocument()
Dim checkBox As DevExpress.XtraRichEdit.API.Native.CheckBox = document.FormFields.InsertCheckBox(currentPosition)
checkBox.Name = "check1"
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/FormFieldsActions.vb#L13
Dim currentPosition As DocumentPosition = document.CaretPosition
Dim checkBox As DevExpress.XtraRichEdit.API.Native.CheckBox = document.FormFields.InsertCheckBox(currentPosition)
checkBox.Name = "check1"
word-document-api-examples/VB/CodeExamples/FormFieldsActions.vb#L20
' Insert a checkbox at the specified position.
Dim checkBox As DevExpress.XtraRichEdit.API.Native.CheckBox = wordProcessor.Document.FormFields.InsertCheckBox(currentPosition)
' Specify the checkbox properties.
See Also