// 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");