//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; ws.Range["A:A"].ColumnWidthInPixel = 30d; ws.Range["B:B"].ColumnWidthInPixel = 106d; // Three check states ws.Range["B2"].Value = "A checkbox can have 3 check states."; var checkBox1 = ws.Controls.AddCheckBox(23.1, 39.6, 88.5, 25.80); checkBox1.Display3DShading = true; checkBox1.IsChecked = false; var checkBox2 = ws.Controls.AddCheckBox(23.1, 72, 88.5, 21); checkBox2.IsChecked = true; checkBox2.Text = "Checked"; var checkBox3 = ws.Controls.AddCheckBox(23.1, 101.4, 88.5, 20.39); checkBox3.IsChecked = null; checkBox3.Text = "Mixed"; // Data binding ws.Range["B11"].Value = "It also supports data binding."; var checkBox4 = ws.Controls.AddCheckBox(22.5, 175.8, 104.1, 23.39); checkBox4.LinkedCell = ws.Range["D13"]; checkBox4.IsChecked = true; // Save to an excel file workbook.Save("CheckBoxesBasicUsage.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws As IWorksheet = workbook.Worksheets("Sheet1") ws.Range("A:A").ColumnWidthInPixel = 30.0R ws.Range("B:B").ColumnWidthInPixel = 106.0R ' Three check states ws.Range!B2.Value = "A checkbox can have 3 check states." With ws.Controls.AddCheckBox(23.1, 39.6, 88.5, 25.8) .Display3DShading = True .IsChecked = False End With With ws.Controls.AddCheckBox(23.1, 72, 88.5, 21) .IsChecked = True .Text = "Checked" End With With ws.Controls.AddCheckBox(23.1, 101.4, 88.5, 20.39) .IsChecked = Nothing .Text = "Mixed" End With ' Data binding ws.Range!B11.Value = "It also supports data binding." With ws.Controls.AddCheckBox(22.5, 175.8, 104.1, 23.39) .LinkedCell = ws.Range!D13 .IsChecked = True End With ' save to an excel file workbook.Save("CheckBoxesBasicUsage.xlsx")