// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); IButton button1 = ws.getControls().addButton(50, 30, 120, 40); button1.setText("This is a button"); button1.setPrintObject(true); button1.setHorizontalTextAlignment(HorizontalAlignment.Center); button1.setVerticalTextAlignment(VerticalAlignment.Center); // Save to an excel file workbook.save("ButtonsBasicUsage.xlsx");
// Create a new workbook var workbook = Workbook() val ws = workbook.getWorksheets().get("Sheet1") val button1 = ws.getControls().addButton(50.0, 30.0, 120.0, 40.0) button1.setText("This is a button") button1.setPrintObject(true) button1.setHorizontalTextAlignment(HorizontalAlignment.Center) button1.setVerticalTextAlignment(VerticalAlignment.Center) // Save to an excel file workbook.save("ButtonsBasicUsage.xlsx")