Skip to main content Skip to footer

Programmatically Add Form Controls to Excel Spreadsheets in .NET, C#, VB, Java

Form

Figure 1 Feedback Form Use Case example

Download Your Free 30-day Trial Version of GrapeCity Documents for Excel v5.2 .NET or GrapeCity Documents for Excel v5.2 Java Today!

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 and Java includes new support for these Form Controls:

Button

Button

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.

Online Demos for Button Control: C# | VB | Java | Kotlin

CheckBox

CheckBox

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# | VB | Java | 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.

Online Demos for CheckBox Control: C# | VB | Java | Kotlin

Dropdown

Dropdown

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.

Online Demos for Dropdown Control: C# | VB | Java | Kotlin

GroupBox

GroupBox

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# | VB | Java | 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.

Online Demos for GroupBox Control: C# | VB | Java | Kotlin

Label

Label

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.

Online Demos for Label Control: C# | VB | Java | Kotlin

ListBox

ListBox

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.

Online Demos for ListBox Control: C# | VB | Java | Kotlin

OptionButton

OptionButton

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.

Online Demos for OptionButton Control: C# | VB | Java | Kotlin

ScrollBar

ScrollBar

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.

Online Demos for ScrollBar Control: C# | VB | Java | Kotlin

Spinner

Spinner

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.

Online Demos for Spinner Control: C# | VB | Java | Kotlin

Excel Form Controls Shape Features

Form Control Shape Features

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.

Online Demos for Form Controls Shape Features: C# | VB | Java | Kotlin

Print Excel Form Controls to PDF

Print Excel Form Controls to PDF

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.

Online Demos for Printing Excel Form Controls to PDF: C# | VB | Java | Kotlin

Use Case: Feedback Form

Form

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, please see the online demos linked below.

Online Demos for Feedback Form Use Case: C# | VB | Java | Kotlin

Download Your Free 30-day Trial Version of GrapeCity Documents for Excel v5.2 .NET or GrapeCity Documents for Excel v5.2 Java Today!

 

comments powered by Disqus