//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; // Option buttons are grouped by group boxes. var rngB2 = "Option buttons are grouped by group boxes."; ws.Range["B2"].Value = rngB2; ws.Range["B13:C13"].Value = new object[,] { { "Value", 1d} }; ws.Range["E13:F13"].Value = new object[,] { { "Value", 2d} }; ws.Range["A:A"].ColumnWidthInPixel = 37d; var group1 = ws.Controls.AddGroupBox(29.75, 48.2, 136.5, 113.99); group1.Text = "Group 1"; var optionButton2 = ws.Controls.AddOptionButton(39.45, 67.1, 98, 15.60); optionButton2.LinkedCell = ws.Range["C13"]; optionButton2.IsChecked = true; ws.Controls.AddOptionButton(39.45, 97.5, 98, 17.40); ws.Controls.AddOptionButton(39.45, 131.2, 98, 17.5); var group2 = ws.Controls.AddGroupBox(191.95, 48.2, 136.5, 113.99); group2.Text = "Group 2"; ws.Controls.AddOptionButton(200.35, 65.7, 117.6, 18.5); var optionButton7 = ws.Controls.AddOptionButton(200.35, 95.99, 117.6, 21.28); optionButton7.LinkedCell = ws.Range["F13"]; optionButton7.IsChecked = true; ws.Controls.AddOptionButton(200.35, 129.2, 117.6, 21.40); // Save to an excel file workbook.Save("OptionButtonsBasicUsage.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws As IWorksheet = workbook.Worksheets("Sheet1") ' Option buttons are grouped by group boxes. ws.Range!B2.Value = "Option buttons are grouped by group boxes." ws.Range("B13:C13").Value = New Object(,) { {"Value", 1.0R} } ws.Range("E13:F13").Value = New Object(,) { {"Value", 2.0R} } ws.Range("A:A").ColumnWidthInPixel = 37.0R ws.Controls.AddGroupBox(29.75, 48.2, 136.5, 113.99). Text = "Group 1" With ws.Controls.AddOptionButton(39.45, 67.1, 98, 15.6) .LinkedCell = ws.Range!C13 .IsChecked = True End With ws.Controls.AddOptionButton(39.45, 97.5, 98, 17.4) ws.Controls.AddOptionButton(39.45, 131.2, 98, 17.5) ws.Controls.AddGroupBox(191.95, 48.2, 136.5, 113.99). Text = "Group 2" ws.Controls.AddOptionButton(200.35, 65.7, 117.6, 18.5) With ws.Controls.AddOptionButton(200.35, 95.99, 117.6, 21.28) .LinkedCell = ws.Range!F13 .IsChecked = True End With ws.Controls.AddOptionButton(200.35, 129.2, 117.6, 21.4) ' save to an excel file workbook.Save("OptionButtonsBasicUsage.xlsx")