Adding Cell Controls in Columns

Introduction

Currently, Aspose.Cells.GridDesktop support adding three types of cell controls, which include the following:

  • Button
  • CheckBox
  • ComboBox

All of these controls are derived from an abstract class, CellControl.

IMPORTANT: If you want to add cell controls to a single cell instead of the whole column then you can refer to Adding Cell Controls in Worksheets.

Adding Button

To add buttons into a column using Aspose.Cells.GridDesktop, please follow the steps below:

  • Add Aspose.Cells.GridDesktop control to your Form
  • Access any desired Worksheet
  • Add Button to any specified Column of the Worksheet

NOTE: While adding Button, we can specify the width, height and caption of the button.

Above code snippet adds buttons to all cells of the specified column. Whenever any cell of that specific column is selected, a button becomes visible. For more information about the event handling of buttons, please refer to the Event Handling of a Button Control.

Adding CheckBox

To add checkboxes into a column using Aspose.Cells.GridDesktop, please follow the steps below:

  • Add Aspose.Cells.GridDesktop control to your Form
  • Access any desired Worksheet
  • Add CheckBox to any specified Column of the Worksheet

NOTE: While adding CheckBox, we can also specify the state of the checkbox.

Above code snippet adds checkboxes to all cells of the specified column. For more information about the event handling of checkboxes, please refer to the Event Handling of a CheckBox Control.

Adding ComboBox

To add comboboxes into a column using Aspose.Cells.GridDesktop, please follow the steps below:

  • Add Aspose.Cells.GridDesktop control to your Form
  • Access any desired Worksheet
  • Create an array of items (or values) that will be added to ComboBox
  • Add ComboBox (containing items or values) to any specified Column of the Worksheet

Above code snippet adds comboboxes to all cells of the specified column. Whenever any cell of that specific column is selected, a combobox becomes visible. For more information about the event handling of comboboxes, please refer to the Event Handling of a ComboBox Control.