We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting Name Property of Checkbox

Hi !!

I have created runtime checkbox by Aspose.cell. How can I change the Name property

of checkbox.

Thanks a lot !


Please use CheckBox.Name property to get / set the name string for the checkbox.

Here is the the sample code:

//Instantiate a new Workbook.
Workbook excelbook = new Workbook();
//Add a checkbox to the first worksheet in the workbook.
int index = excelbook.Worksheets[0].CheckBoxes.Add(5, 5, excelbook.Worksheets[0].Cells.GetRowHeightPixel(5), excelbook.Worksheets[0].Cells.GetColumnWidthPixel(5));
//Get the checkbox object.
Aspose.Cells.CheckBox checkbox = excelbook.Worksheets[0].CheckBoxes[index];
//Set its text string.
checkbox.Text = "Click it!";
//Put a value into B1 cell.
//Set B1 cell as a linked cell for the checkbox.
checkbox.LinkedCell = "B1";
//Check the checkbox by default.
checkbox.Value = true;
checkbox.Name = "MyCheckBox";
//Save the excel file.

Thank you.

I tried, however when I try to put Name property, I don't get it in inteliget.

and I get an error mentioning 'Aspose.Cells.CheckBox does not contain defination for Name'

Appreciate if you guide me.


I think you are using some older version of Aspose.Cells, Please try the latest version (4.4.1):

as the property is there in the APIs.

Thank you.