//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; var button1 = ws.Controls.AddButton(50, 30, 120, 40); button1.Text = "This is a button"; button1.PrintObject = true; button1.HorizontalTextAlignment = HorizontalAlignment.Center; button1.VerticalTextAlignment = VerticalAlignment.Center; // Save to an excel file workbook.Save("ButtonsBasicUsage.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws As IWorksheet = workbook.Worksheets("Sheet1") With ws.Controls.AddButton(50, 30, 120, 40) .Text = "This is a button" .PrintObject = True .HorizontalTextAlignment = HorizontalAlignment.Center .VerticalTextAlignment = VerticalAlignment.Center End With ' save to an excel file workbook.Save("ButtonsBasicUsage.xlsx")