Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Apr 04, 2022 6:45 am

Hi
I will export an excel sheet with multiple checkboxes in columns and rows. I tried a solution from this forum but doesn't work. See excel sample. Only one checkbox will be set on the end of the sheet.

int i = 0;
foreach (item in obect)
{
i++;
ICheckBox checkbox = sheet.CheckBoxes.AddCheckBox(i, 12,15,75);
checkbox.CheckState = (CheckState)ConversionHelper.ToInt16(position.Properties.IsVisible);
checkbox.Name = "CH" + i + "12";
checkbox1.LinkedCell = sheet.Range[i, 12];
}
ICheckBox checkbox1 = sheet.CheckBoxes["CH212"];
checkbox1.LinkedCell = sheet.Range[2, 12];

Tried both ways to set the checkbox in the loop and also tried to set one checkbox on first row. But even the checkbox is at the end of the sheet.

Anybody know where is the bug?
Attachments
multiple checkboxes.png
multiple checkboxes.png (11.58 KiB) Viewed 358 times

UDupper
 
Posts: 1
Joined: Sun Jul 15, 2018 11:50 am

Tue Apr 05, 2022 8:01 am

Hello,

Thanks for your inquiry.

According to your code, I did some tests and multiple checkboxes can be generated successfully(as the screenshot below). The product I'm using is Spire.Xls For .Net v12.3.8. If you are not using the laest version, please update it and try again.
pic.png
pic.png (28.6 KiB) Viewed 344 times
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.XLS

cron