Checkbox update in existing spreadsheet

I am implementing Aspose.Cells into an existing ASP.NET website to open up an existing Excel XLSX file, fill out data in some cells on a single worksheet, and save the workbook.


I have gotten everything working with the exception of Checkboxes on the worksheet. The following code is not working:

Dim cb As Aspose.Cells.Drawing.CheckBox
cb = worksheet.CheckBoxes(0)
cb.Value = True

If I step through my code, I can see that the value of the checkbox is False, and I can see it change to True, but when I save the workbook and open the spreadsheet, the checkbox is not checked.

Does anyone have a solution for this problem?

Thank you!


Hi Eric,


Thank you for contacting Aspose support.

In order mark the CheckBox as checked, please use the CheckBox.CheckedValue as demonstrated below. In case the problem persists, please provide us your input spreadsheet for further analysis.

VB.NET

Dim book As New Workbook(dir & “checkbox.xlsx”)
book.Worksheets(0).CheckBoxes(0).CheckedValue = CheckValueType.Checked
book.Save(dir & “output.xlsx”)

Thank you Babar!


I have gotten it working. I compared my spreadsheet to yours, and it turns out I was not setting the Cell link for any of my checkboxes. Once I set that for all checkboxes it is now working as expected.

–Eric

Hi Eric,


Thank you for sharing the resolution. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.