// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); // Simple usage ws.getRange("B2").setValue("The GroupBox control provides a titled container for contents."); IGroupBox groupBox1 = ws.getControls().addGroupBox(23.45, 49.9, 174, 50.1); groupBox1.setText("Group 1"); // Group multiple option buttons. ws.getRange("B9").setValue("A GroupBox can group multiple option buttons."); IRange e12 = ws.getRange("E12"); e12.setValue(1d); ws.getRange("A:A").setColumnWidthInPixel(25d); IGroupBox groupBox2 = ws.getControls().addGroupBox(23.55, 153.6, 136.39, 116.4); groupBox2.setText("Group 2"); IOptionButton optionButton3 = ws.getControls().addOptionButton(42.75, 170.4, 97.7, 15.79); optionButton3.setLinkedCell(e12); optionButton3.setIsChecked(true); ws.getControls().addOptionButton(42.75, 201, 97.7, 17.69); IOptionButton optionButton5 = ws.getControls().addOptionButton(42.75, 235.2, 97.7, 17); optionButton5.setDisplay3DShading(true); // Save to an excel file workbook.save("GroupBoxesBasicUsage.xlsx");
// Create a new workbook var workbook = Workbook() val ws = workbook.worksheets["Sheet1"] // Simple usage ws.getRange("B2").value = "The GroupBox control provides a titled container for contents." val groupBox1 = ws.controls.addGroupBox(23.45, 49.9, 174.0, 50.1) groupBox1.text = "Group 1" // Group multiple option buttons. ws.getRange("B9").value = "A GroupBox can group multiple option buttons." val e12 = ws.getRange("E12") e12.value = 1.0 ws.getRange("A:A").columnWidthInPixel = 25.0 val groupBox2 = ws.controls.addGroupBox(23.55, 153.6, 136.39, 116.4) groupBox2.text = "Group 2" ws.controls.addOptionButton(42.75, 170.4, 97.7, 15.79).apply { linkedCell = e12 isChecked = true } ws.controls.addOptionButton(42.75, 201.0, 97.7, 17.69) ws.controls.addOptionButton(42.75, 235.2, 97.7, 17.0).display3DShading = true // Save to an excel file workbook.save("GroupBoxesBasicUsage.xlsx")