A newer version of this page is available. Switch to the current version.

Checkboxes

  • 2 minutes to read

The RichEditDocumentServer allows you to view and export a document containing checkbox form fields. These form fields are interactive, so end-users can toggle their state as needed. The resulting document can be exported to PDF or HTML format.

XtraRichEdit_Checkboxes

IMPORTANT

Currently, Word Processing Document API supports only checkbox form fields. ActiveX and form control checkboxes are not supported.

Checkboxes in API

Use members from the table below to manage checkboxes in code. Refer to the How to: Create a Checkbox topic for more details.

API

Description

FormFieldCollection.InsertCheckBox

Inserts a checkbox form field to a given document position and adds the created CheckBox object to the FormFieldCollection. Note that you can only insert checkboxes in the main document body. An FormFieldIncorrectSubDocumentException occurs on attempt to insert the checkbox into a comment, header, footer or text box.

FormField.Name

Specifies a bookmark name associated with the checkbox.

CheckBox.State

Gets or sets the checkbox’s state.

CheckBox.SizeMode

Defines the checkbox’s size mode. Use the CheckBox.Size property to specify the exact size.

FormField.HelpTextType

FormField.StatusTextType

Specifies the instructional text type that accompanies the checkbox.

FormField.HelpText

FormField.StatusText

Gets or sets the checkbox’s instructional text. With the …TextType property set to FormFieldTextType.Auto, make sure that the …Text property value is equal to one of the document’s AutoText gallery entries.

DocumentPosition currentPosition = server.Document.CaretPosition;
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";