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

Free Support Forum - aspose.com

How to disable worksheet.CheckBoxes?

How to disable the checkbox in a worksheet, any ideas?
Some checkbox in cells can be checked/unchecked by user, some need to be disalbed to users.

int index = sheet.CheckBoxes.Add(iRow, iColumn, 21, 100);
// place holder
cells[row, startColumn].PutValue(" " + data.Display);
CheckBox checkBox = sheet.CheckBoxes[index];
checkBox.Placement = PlacementType.Move;
checkBox.CheckedValue = CheckValueType.Checked;

Hi Xu,

Thank you for contacting Aspose support.

We would request you to please provide us a sample spreadsheet to exhibit your requirements. You may manually create such a sample using MS Excel application and share it here for reference. This will help us to understand your exact requirement, and we will further pursue it to provide the solution with Aspose.Cells APIs.

Here attached the file, checkbox in the G column allow user to click, in the H column , cant be checked/unchecked, I wanna make checkbox in H column disabled.

Hi Xu,

Thank you for sharing the sample spreadsheet. We have checked your sample and have noticed that you have applied the worksheet protection, however, the checkboxes in the worksheet “Healthcare” can still be selected by the user. Please check the attached spreadsheet that I manually updated using Excel 2013 by selecting all the checkboxes from the aforesaid worksheet.

In case you wish to achieve the worksheet protection using the Aspose.Cells APIs then please go through the detailed article on Protecting Worksheets that demonstrates how you can protect a range of cells, row(s), column(s) and complete worksheet.

I have locked the cells which include checkbox , but the checkbox still can checked/unchecked?

Hi Xu,

Please note, locking the underlying cells will not lock the CheckBoxes. You have to get the collection of the CheckBoxes from the worksheet instance and iterate over them to set the CheckBox.IsLocked to true for the desired CheckBoxes as demonstrated below. Please also check the input/output spreadsheets for your reference.


var book = new Workbook(“D:/checkboxes.xlsx”);
var sheet = book.Worksheets[0];
var checkboxes = sheet.CheckBoxes;
foreach (CheckBox checkbox in checkboxes)
if (checkbox.Name == “CheckBox 1”)
checkbox.IsLocked = true;


We were unable to get this scenario working with your provided spreadsheet due to unknown reasons, and we couldn't further investigate the cause because your provided spreadsheet is protected.