//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; // Simple usage ws.Range["B2"].Value = "The GroupBox control provides a titled container for contents."; var groupBox1 = ws.Controls.AddGroupBox(23.45, 49.9, 174, 50.1); groupBox1.Text = "Group 1"; // Group multiple option buttons. ws.Range["B9"].Value = "A GroupBox can group multiple option buttons."; IRange e12 = ws.Range["E12"]; e12.Value = 1d; ws.Range["A:A"].ColumnWidthInPixel = 25d; var groupBox2 = ws.Controls.AddGroupBox(23.55, 153.6, 136.39, 116.4); groupBox2.Text = "Group 2"; var optionButton3 = ws.Controls.AddOptionButton(42.75, 170.4, 97.7, 15.79); optionButton3.LinkedCell = e12; optionButton3.IsChecked = true; ws.Controls.AddOptionButton(42.75, 201, 97.7, 17.69); var optionButton5 = ws.Controls.AddOptionButton(42.75, 235.2, 97.7, 17); optionButton5.Display3DShading = true; // Save to an excel file workbook.Save("GroupBoxesBasicUsage.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws As IWorksheet = workbook.Worksheets("Sheet1") ' Simple usage ws.Range!B2.Value = "The GroupBox control provides a titled container for contents." ws.Controls.AddGroupBox(23.45, 49.9, 174, 50.1). Text = "Group 1" ' Group multiple option buttons. ws.Range!B9.Value = "A GroupBox can group multiple option buttons." Dim e12 As IRange = ws.Range!E12 e12.Value = 1.0 ws.Range("A:A").ColumnWidthInPixel = 25.0 ws.Controls.AddGroupBox(23.55, 153.6, 136.39, 116.4). Text = "Group 2" With ws.Controls.AddOptionButton(42.75, 170.4, 97.7, 15.79) .LinkedCell = e12 .IsChecked = True End With ws.Controls.AddOptionButton(42.75, 201, 97.7, 17.69) ws.Controls.AddOptionButton(42.75, 235.2, 97.7, 17). Display3DShading = True ' save to an excel file workbook.Save("GroupBoxesBasicUsage.xlsx")