// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); // Option buttons are grouped by group boxes. String rngB2 = "Option buttons are grouped by group boxes."; ws.getRange("B2").setValue(rngB2); ws.getRange("B13:C13").setValue(new Object[][] { { "Value", 1d} }); ws.getRange("E13:F13").setValue(new Object[][] { { "Value", 2d} }); ws.getRange("A:A").setColumnWidthInPixel(37d); IGroupBox group1 = ws.getControls().addGroupBox(29.75, 48.2, 136.5, 113.99); group1.setText("Group 1"); IOptionButton optionButton2 = ws.getControls().addOptionButton(39.45, 67.1, 98, 15.60); optionButton2.setLinkedCell(ws.getRange("C13")); optionButton2.setIsChecked(true); ws.getControls().addOptionButton(39.45, 97.5, 98, 17.40); ws.getControls().addOptionButton(39.45, 131.2, 98, 17.5); IGroupBox group2 = ws.getControls().addGroupBox(191.95, 48.2, 136.5, 113.99); group2.setText("Group 2"); ws.getControls().addOptionButton(200.35, 65.7, 117.6, 18.5); IOptionButton optionButton7 = ws.getControls().addOptionButton(200.35, 95.99, 117.6, 21.28); optionButton7.setLinkedCell(ws.getRange("F13")); optionButton7.setIsChecked(true); ws.getControls().addOptionButton(200.35, 129.2, 117.6, 21.40); // Save to an excel file workbook.save("OptionButtonsBasicUsage.xlsx");