Multiple groups of radio buttons on the same Excel worksheet using Aspose Cells

Matthew Strawbridge picture Matthew Strawbridge · Jan 11, 2013 · Viewed 27.2k times · Source

Is it possible to add more than one group of radio buttons to a single Excel worksheet using Aspose Cells for .NET?

I've tried doing this, but they they all seem to share the same group. Adding the radio buttons inside GroupBoxes doesn't seem to help. What am I doing wrong?

The sample code on Aspose's website only adds one set of radio buttons to each worksheet. Is it even possible to add multiple groups? (It works if you set it up manually in Excel.)

Answer

Matthew Strawbridge picture Matthew Strawbridge · Jan 11, 2013

It took me a while to figure out what the problem was. The radio buttons in a group must be completely inside the group boxes (they can share a border with the box, but must not stray outside). Any radio buttons that are not completely bounded by a group box are assigned to the default group.

By default the radio buttons have no border or background, so it's not obvious just from looking at the generated Excel worksheet whether or not they are completely inside their grouping box. In my case, the radio buttons were overlapping the border of the grouping box.

Once I reduced the size of the radio buttons so they were contained completely inside the grouping box, it all worked as expected: two independent groups of radio buttons.