Programmatically Add Form Controls to Excel Spreadsheets in .NET, C#, VB, Java
Tags: webdev, tutorial, dotnet, java
Published: 2022-09-26 15:05:55

---
canonical_url: https://www.grapecity.com/blogs/programmatically-add-form-controls-to-excel-spreadsheets-in-net-c-sharp-vb-java
description: Learn how to programmatically add form controls to Excel spreadsheets in .NET, C#, VB, Java. See more from GrapeCity Documents today.
---

![Form](https://files.grapecity.com/gc-website-media/iqpdmw0x/01-form.png?width=500&height=474.21875)

_Figure 1 Feedback Form Use Case example_

Adding Form Controls to your Excel spreadsheets can turn your basic reports into interactive dashboards with rich interactions and empower the user to customize the report sections or use it as a tool for selecting and reviewing key performance indicators. **GrapeCity Documents for Excel v5.2** for [**.NET**](https://www.grapecity.com/documents-api-excel) and [**Java**](https://www.grapecity.com/documents-api-excel-java) includes new support for these Form Controls:

*   [Button](#button)
*   [CheckBox](#check)
*   [Dropdown](#drop)
*   [GroupBox](#group)
*   [Label](#label)
*   [ListBox](#list)
*   [OptionButton](#option)
*   [ScrollBar](#scroll)
*   [Spinner](#spinner)
*   [Form Controls Shape Features](#shape)
*   [Print Form Controls to PDF](#print)
*   [Use Case: Feedback Form](#use-case)

### <a id="button"></a>Button

![Button](https://files.grapecity.com/gc-website-media/fxwg4nza/02-form.png?width=500&height=212.9817444219067)

_Figure 2 Button control example_

Button controls are commonly used to invoke some script function, for example, printing the worksheet. Button controls do not support linking to a cell value, so they can’t be used to affect cell formulas or calculations. They are generally only used in advanced use cases with macro-enabled workbooks to automate the workbook.

**GrapeCity Documents for Excel v5.2** introduces new support for Button controls, with new APIs for creating and updating Button controls in workbooks using **.NET** or **Java**.

### <a id="check"></a>CheckBox

![CheckBox](https://files.grapecity.com/gc-website-media/mnmm5lj5/03-form.png?width=500&height=211.26760563380282)

_Figure 3 CheckBox control examples_

CheckBox controls are commonly used to toggle between two or three options, using the state of the check box (unchecked = false, checked = true, mixed = null/Nothing). CheckBox controls are generally linked to a cell value, so the CheckBox can directly affect cell formulas and calculations by changing the value in the linked cell. All formulas referencing the linked cell will recalculate, and this can affect many parts of the workbook at once. For example, a formula in a defined name can use the **IF** function to switch between two different cell ranges in the workbook. Then that defined name can be used in the formula for a Linked Image (a.k.a. Camera Picture – see demos for [C#](https://www.grapecity.com/documents-api-excel/demos/addcamerapicture?devLang=csharp) | [VB](https://www.grapecity.com/documents-api-excel/demos/addcamerapicture?devLang=vb) | [Java](https://www.grapecity.com/documents-api-excel-java/demos/addcamerapicture?devLang=java) | [Kotlin](https://www.grapecity.com/documents-api-excel-java/demos/addcamerapicture?devLang=kotlin)) to specify the target range. This makes a CheckBox that can switch the linked image between showing the two different target ranges.

**GrapeCity Documents for Excel v5.2** introduces new support for CheckBox controls, with new APIs for creating and updating CheckBox controls in workbooks and linking them to cells using **.NET** or **Java**.

### <a id="drop"></a>Dropdown

![Dropdown](https://files.grapecity.com/gc-website-media/1ntkyv5l/04-form.png?width=500&height=221.75290390707497)

_Figure 4 Dropdown control examples_

Dropdown controls are commonly used to show a list of items from which the user can select one item. Dropdown controls are generally linked to a cell value, which reflects the selected value’s index in the Dropdown control’s list, and Dropdown controls can also use a cell range to specify the data source for the list. The values in the cell range become the items displayed in the Dropdown list.

**GrapeCity Documents for Excel v5.2** introduces new support for Dropdown controls, with new APIs for creating and updating Dropdown controls in workbooks and linking them to cells and data source ranges using **.NET** or **Java**.

### <a id="group"></a>GroupBox

![GroupBox](https://files.grapecity.com/gc-website-media/u3zdyive/05-form.png?width=500&height=221.75290390707497)

_Figure 5 GroupBox control examples_

GroupBox controls are commonly used to group OptionButton controls together to create an option group. They can be used to group any types of controls, including Labels, Dropdowns, and CheckBoxes, to help organize more complex user interfaces. It is not necessary but often helpful to use the Shape Grouping feature (see demos for [C#](https://www.grapecity.com/documents-api-excel/demos/shapegroup?devLang=csharp) | [VB](https://www.grapecity.com/documents-api-excel/demos/shapegroup?devLang=vb) | [Java](https://www.grapecity.com/documents-api-excel-java/demos/shapegroup?devLang=java) | [Kotlin](https://www.grapecity.com/documents-api-excel-java/demos/shapegroup?devLang=kotlin)) to group together the GroupBox and its other controls.

**GrapeCity Documents for Excel v5.2** introduces new support for GroupBox controls, with new APIs for creating and updating GroupBox controls in workbooks and for grouping them with other controls using **.NET **or **Java**.

### <a id="label"></a>Label

![Label](https://files.grapecity.com/gc-website-media/4rch4bx1/06-form.png?width=500&height=212.9817444219067)

_Figure 6 Label control example_

Label controls are commonly used to label other control, so the user can tell what is expected in the other control. GroupBox controls include a built-in Label control for the group box caption. Still, sometimes you need to include some longer instructional text to explain how to use particular parts of the form, and Label controls are perfect for that.

**GrapeCity Documents for Excel v5.2** introduces new support for Label controls, with new APIs for creating and updating Label controls in workbooks using **.NET** or **Java**.

### <a id="list"></a>ListBox

![ListBox](https://files.grapecity.com/gc-website-media/2h4l2ydg/07-form.png?width=500&height=263.1578947368421)

_Figure 7 ListBox control examples_

ListBox controls are commonly used to show a list of items from which the user can make a selection. ListBox controls can be linked to a cell value like a Dropdown and have a data source range to specify the list items like a Dropdown. ListBox controls can also permit multiple selections by changing the selection mode.

**GrapeCity Documents for Excel v5.2** introduces new support for ListBox controls, with new APIs for creating and updating Label controls in workbooks using **.NET** or **Java**.

### <a id="option"></a>OptionButton

![OptionButton](https://files.grapecity.com/gc-website-media/pfygwffl/08-form.png?width=500&height=218.97810218978103)

_Figure 8 OptionButton control examples_

OptionButton controls are commonly used to select one option from a group of OptionButtons, usually inside a GroupBox, to indicate which OptionButtons are part of the same group. OptionButton controls can be linked to a cell value and reflect the index of the selected OptionButton in the group.

**GrapeCity Documents for Excel v5.2** introduces new support for OptionButton controls, with new APIs for creating and updating OptionButton controls in workbooks using **.NET** or **Java**.

### <a id="scroll"></a>ScrollBar

![ScrollBar](https://files.grapecity.com/gc-website-media/a15mbqns/09-form.png?width=500&height=220.12578616352204)

_Figure 9 ScrollBar control examples_

ScrollBar controls are commonly used to scroll left and right, or up and down, between the integer values in a specified range, for example, 1 to 10\. ScrollBar controls can be linked to a cell value like a Dropdown and reflect the current value of the ScrollBar position indicator, which the user can drag to change the value or change by clicking on the ScrollBar arrow buttons.

**GrapeCity Documents for Excel v5.2** introduces new support for ScrollBar controls, with new APIs for creating and updating ScrollBar controls in workbooks using **.NET** or **Java**.

### <a id="spinner"></a>Spinner

![Spinner](https://files.grapecity.com/gc-website-media/lbki0uf1/10-form.png?width=500&height=221.29436325678498)

_Figure 10 Spinner control examples_

Spinner controls are commonly used to change the value of a linked cell to the next or previous numeric value in a predefined list of values. Spinner controls can also be used in unbound mode, not linked to any cell value, generally with advanced macro-enabled workbooks using script code to modify the workbook when the Spinner control is clicked.

**GrapeCity Documents for Excel v5.2** introduces new support for Spinner controls, with new APIs for creating and updating Spinner controls in workbooks using **.NET** or **Java**.

### <a id="shape"></a>Excel Form Controls Shape Features

![Form Control Shape Features](https://files.grapecity.com/gc-website-media/snsjwdoj/11-form.png?width=500&height=180.50541516245485)

_Figure 11 Form Controls Shape Features example_

This example shows how Form controls are also Shapes and support many of the same APIs for duplicating, grouping, and other shape features. Form controls can easily be copied from one cell range to another using simple code.

**GrapeCity Documents for Excel v5.2** introduces new support for Form controls Shape Features, with new APIs for duplicating Form controls in workbooks using **.NET** or **Java**.

### <a id="print"></a>Print Excel Form Controls to PDF

![Print Excel Form Controls to PDF](https://files.grapecity.com/gc-website-media/i3jji2bb/12-form.png?width=500&height=177.3049645390071)

_Figure 12 Print Form Controls to PDF example_

Form Controls can easily be printed to PDF and show exactly as they appear in the workbook.

**GrapeCity Documents for Excel v5.2** introduces new support for easily printing Form Controls in Excel workbooks to PDF using **.NET** or **Java**.

### <a id="use-case"></a>Use Case: Feedback Form

![Form](https://files.grapecity.com/gc-website-media/iqpdmw0x/01-form.png?width=500&height=474.21875)

_Figure 13 Feedback Form Use Case example_

Using Excel Form Controls with **GrapeCity Documents for Excel v5.2**, you can create a rich and complex form for users to complete and even implement code to automate the collation of results in a new spreadsheet.

To view this example created with GrapeCity Documents for Excel v5.2 and see all the documentation used in this article, please see the online demos linked below.

GcExcel For Java - Java/Kotlin: [https://www.grapecity.com/documents-api-excel-java/demos/controls](https://www.grapecity.com/documents-api-excel-java/demos/controls)

GcExcel For .NET - C#/VB: [https://www.grapecity.com/documents-api-excel/demos/controls](https://www.grapecity.com/documents-api-excel/demos/controls)