---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/ChoiceField
---

# ChoiceField

## Overview

`ChoiceField` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `Field`.

This class provides 25 methods for working with ChoiceField objects in .NET programs.
Available methods include: `Accept`, `AddOption`, `ChangeAfterResize`, `ChoiceField`, `Clone`, `CopyTo`, `DeleteOption`, `ExecuteFieldJavaScript`, `ExportToJson`, `ExportValueToJson`, `Field`, `Flatten`, and 10 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Action`, `Actions`, `ActiveState`, `Alignment`, `AlternateName`, `AnnotationFlags`, and 82 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `IsCombo` | `bool` | Read | Gets the is combo. |
| `IsEditable` | `bool` | Read | Gets the is editable. |
| `IsMultiSelect` | `bool` | Read | Gets the is multi select. |
| `IsSorted` | `bool` | Read | Gets the is sorted. |
| `MultiSelect` | `bool` | Read/Write | Get/set MultiSelect (/Ff bit 22 — 0-based 21). |
| `CommitImmediately` | `bool` | Read/Write | Get/set CommitOnSelChange (/Ff bit 27 — 0-based 26). |
| `SelectedItems` | `int[]` | Read/Write | 0-based selected-option indices (int[] sibling of SelectedIndices; setter rewrites /V from the matching options). |
| `SelectedValues` | `IReadOnlyList` | Read/Write | The currently selected values. |
| `SelectedIndices` | `IReadOnlyList` | Read | The 0-based indices of selected values within the Options list. |
| `Options` | `OptionCollection` | Read | The collection of choice options. |
| `Selected` | `int` | Read/Write | 1-based index of the currently selected option, or -1 when no option is selected or the selection cannot be matched against the option list. |
| `Value` | `string?` | Read/Write | The field value (/V). |
| `Type` | `FieldType` | Read | The field type. |
| `FullName` | `string?` | Read | The fully qualified field name. |
| `Name` | `string?` | Read/Write | The fully qualified field name (alias for FullName). |
| `TextHorizontalAlignment` | `Aspose.Pdf.HorizontalAlignment` | Read/Write | Text-specific horizontal alignment override applied to the field's widget appearance. |
| `PageIndex` | `int` | Read | 1-based index of the page that owns this field's widget. |
| `PartialName` | `string?` | Read/Write | The partial field name (/T). |
| `NormalAppearance` | `XForm?` | Read | The field's "Normal" appearance (the /AP /N entry). |
| `Appearance` | `Aspose.Pdf.Annotations.AppearanceDictionary` | Read | The field widget's appearance streams (the /AP entry), keyed by appearance name. |
| `OnActivated` | `Annotations.PdfAction?` | Read/Write | The action triggered when this field is activated (/A entry). |
| `Count` | `int` | Read | Number of kids in this field's /Kids array — either child fields (hierarchy nodes) or widget annotations (a terminal field with multiple visual widgets, such as a grouped checkbox/radio). |
| `Fields` | `Field[]` | Read | Field-typed child kids of this field as a snapshot array — convenience accessor mirroring Fields on the form. |
| `DefaultValue` | `string?` | Read | The default value (/DV). |
| `AlternateName` | `string?` | Read/Write | The alternate field name / tooltip (/TU entry). |
| `Flags` | `Aspose.Pdf.Annotations.AnnotationFlags` | Read/Write | The widget annotation flags (/F entry), e.g. |
| `TabOrder` | `int` | Read/Write | Tab order index for this field. |
| `IsReadOnly` | `bool` | Read | Whether the field is read-only. |
| `ReadOnly` | `bool` | Read/Write | Whether the field is read-only (settable alias for API parity). |
| `IsRequired` | `bool` | Read | Whether the field is required. |
| `Characteristics` | `Aspose.Pdf.Annotations.Characteristics` | Read | Appearance characteristics (border / background colors, widget rotation). |
| `DefaultAppearance` | `Aspose.Pdf.Annotations.DefaultAppearance` | Read/Write | Default appearance (font, size, colour) of the field — per published reference on WidgetAnnotation. |
| `Rect` | `Rectangle?` | Read/Write | The field rectangle. |
| `Border` | `Border?` | Read/Write | The field border. |
| `Color` | `Color` | Read/Write | The field color (stored in /DA default appearance string as RGB). |
| `AnnotationIndex` | `int` | Read/Write | 1-based index of the widget annotation used by AcroForm rendering when the field has multiple widgets. |
| `FitIntoRectangle` | `bool` | Read/Write | Global flag: when true, a field's value is auto-resized to fit its widget rectangle. |
| `IsGroup` | `bool` | Read | Whether this field is a container/group of child fields. |
| `IsSharedField` | `bool` | Read/Write | Whether this field belongs to a shared-fields group. |
| `IsSynchronized` | `bool` | Read | Whether the collection is thread-safe. |
| `SyncRoot` | `object` | Read | Synchronization root; returns this instance. |
| `MaxFontSize` | `double` | Read/Write | Maximum font size used by the field's appearance auto-fit. |
| `MinFontSize` | `double` | Read/Write | Minimum font size used by the field's appearance auto-fit. |
| `MappingName` | `string?` | Read/Write | Mapping name used by external scripts to identify the field. |
| `AnnotationType` | `AnnotationType` | Read | Always Widget. |
| `Actions` | `AnnotationActionCollection` | Read | Action slots for the widget's /AA tree. |
| `Exportable` | `bool` | Read/Write | Whether the widget's value should be exported on form submit. |
| `Highlighting` | `HighlightingMode` | Read/Write | Visual highlighting mode used when the user clicks the widget (/H entry). |
| `Parent` | `Forms.Field?` | Read | Parent Field when this widget is the visual child of an AcroForm field. |
| `Required` | `bool` | Read/Write | Whether the widget must be filled before submit (/Ff bit 2). |
| `HighlightMode` | `string` | Read | The highlight mode (/H entry). |
| `DefaultAppearanceString` | `string?` | Read | The default appearance string (/DA entry). |
| `FieldValue` | `string?` | Read | The field value (/V entry). |
| `DefaultFieldValue` | `string?` | Read | The default field value (/DV entry). |
| `FieldType` | `string?` | Read | The field type (/FT entry). |
| `Width` | `double` | Read/Write | The width of the annotation rectangle. |
| `Height` | `double` | Read/Write | The height of the annotation rectangle. |
| `ActiveState` | `string?` | Read/Write | Currently-active appearance state (/AS entry). |
| `Alignment` | `TextAlignment` | Read/Write | Text alignment (for free-text / widget annotations carrying rich text). |
| `HorizontalAlignment` | `Aspose.Pdf.HorizontalAlignment` | Read/Write | Horizontal alignment, exposed in addition to Alignment; the two are independently settable. |
| `States` | `AppearanceDictionary` | Read | Appearance-state dictionary (the per-state sub-dict of AP/N, e.g. |
| `UpdateAppearanceOnConvert` | `bool` | Read/Write | Whether to regenerate the appearance stream when the annotation is saved into a converted document. |
| `UseFontSubset` | `bool` | Read/Write | Whether the embedded font (if any) should be subsetted. |
| `Contents` | `string?` | Read/Write | The annotation contents (text). |
| `Opacity` | `double` | Read/Write | Annotation opacity (0.0 = transparent, 1.0 = opaque). |
| `InteriorColor` | `Color?` | Read/Write | The annotation interior color (/IC entry, for circle/square/line annotations). |
| `Title` | `string?` | Read/Write | The annotation title (author for markup annotations). |
| `Subject` | `string?` | Read/Write | The annotation subject (/Subj entry). |
| `ModifiedDate` | `string?` | Read | The modification date. |
| `Modified` | `DateTime` | Read/Write | The /M (modified) date as a typed DateTime. |
| `AnnotationFlags` | `AnnotationFlags` | Read/Write | Typed alias of Flags exposing AnnotationFlags as a property. |
| `Action` | `PdfAction?` | Read/Write | The action associated with this annotation (/A entry). |
| `Author` | `string?` | Read | The annotation author (/T entry). |
| `AnnotationState` | `string?` | Read | The annotation state (/State entry), e.g. |
| `AnnotationStateModel` | `string?` | Read | The annotation state model (/StateModel entry), e.g. |
| `ReplyType` | `string?` | Read | The reply type (/RT entry), e.g. |
| `InReplyTo` | `Annotation?` | Read/Write | The annotation this one is replying to (/IRT entry). |
| `QuadPoints` | `Point[]` | Read/Write | QuadPoints as an array of Point values. |
| `Page` | `Page?` | Read | The page that owns this annotation, or null when it can't be resolved (e.g. |
| `VerticalAlignment` | `VerticalAlignment` | Read/Write | Vertical alignment applied to this paragraph. |
| `Margin` | `MarginInfo?` | Read/Write | Outer-margin info applied to this paragraph. |
| `IsFirstParagraphInColumn` | `bool` | Read/Write | Force the paragraph to start a new column. |
| `IsKeptWithNext` | `bool` | Read/Write | Keep this paragraph on the same page as the next one. |
| `IsInNewPage` | `bool` | Read/Write | Force the paragraph to start on a new page. |
| `IsInLineParagraph` | `bool` | Read/Write | Inline paragraph flag (does not start a new line). |
| `HyperlinkText` | `string?` | Read/Write | Legacy string-typed hyperlink target. |
| `Hyperlink` | `Hyperlink?` | Read/Write | Typed hyperlink decoration applied to the paragraph. |
| `ZIndex` | `int` | Read/Write | Z-order index used by the DOM renderer. |

## Methods

| Signature | Description |
|-----------|-------------|
| `ChoiceField(doc: Document)` | Calls ChoiceField on this ChoiceField instance. |
| `ChoiceField(doc: Document, rect: Rectangle)` |  |
| `ChoiceField(page: Page, rect: Rectangle)` |  |
| `AddOption(optionName: string)` | Add an option to the choice field. |
| `AddOption(export: string, name: string)` | Add an option with separate export and display values. |
| `DeleteOption(optionName: string)` | Remove the first option matching optionName (either as a bare PdfString or as the display half of an [export, name] pair). |
| `Field(doc: Document)` | Create a field bound to a document. |
| `GetEnumerator()` | Iterates widget annotations for this field's kids in the /Kids array. |
| `CopyTo(array: Aspose.Pdf.Annotations.WidgetAnnotation[], index: int)` | Copy widget annotations into an array starting at index. |
| `ExecuteFieldJavaScript(javaScriptAction: Aspose.Pdf.Annotations.JavascriptAction)` | Execute the supplied JavaScript action against this field. |
| `ExportToJson(stream: Stream)` | Serialise this field to JSON (a single FieldExportingData object) via the supplied stream. |
| `ExportValueToJson(outputJsonStream: Stream, indented: bool)` | Write the field's name, flags and value to a JSON stream. |
| `Flatten()` | Flatten this field — turn its value into static page content. |
| `GetWidgetEnumerator()` | Enumerator typed to WidgetAnnotation. |
| `ImportValueFromJson(inputJsonStream: Stream)` | Read this field's value from a JSON stream. |
| `Recalculate()` | Recalculate the field's value from its calculation script. |
| `SetPosition(point: Aspose.Pdf.Point)` | Move the field's first widget rectangle to the supplied point (top-left corner). |
| `WidgetAnnotation(doc: Document)` | Programmatic ctor — creates a bare widget annotation associated with doc's reader. |
| `GetCheckedStateName()` | Returns the appearance state name that represents the "on" / "checked" state of this widget (typically "Yes"), looked up from the /AP/N dict's keys (anything that isn't "Off"). |
| `Accept(visitor: AnnotationSelector)` | Calls Accept on this ChoiceField instance. |
| `GetRectangle(considerRotation: bool)` | Bounding rectangle adjusted by considerRotation. |
| `ChangeAfterResize(transform: Matrix)` | Adjust the annotation's geometry after the user resized the page or the host rectangle. |
| `UpdateAppearances()` | Regenerate the normal appearance stream (/AP /N) from the annotation's current geometry and colours. |
| `WriteXfdf(writer: System.Xml.XmlWriter)` | Serialize this annotation as an XFDF element to writer (PDF 32000 §12.7.8 / XFDF 3.0). |
| `Clone()` | Shallow clone — copies scalar/ref-shared state. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)