//create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getColumns().get(3).setColumnWidthInPixel(100); CheckBoxCellType cellType = new CheckBoxCellType(); cellType.setCaption("CheckBox"); cellType.setTextTrue("True"); cellType.setTextFalse("False"); cellType.setIsThreeState(true); cellType.setTextAlign(CheckBoxAlign.Right); worksheet.getColumns().get(3).setCellType(cellType); worksheet.getRange("D1:D10").setValue(true); ButtonCellType buttonCellType = new ButtonCellType(); buttonCellType.setText("Button"); buttonCellType.setButtonBackColor("Azure"); buttonCellType.setMarginLeft(10); buttonCellType.setMarginRight(10); worksheet.getRows().get(3).setCellType(buttonCellType); //save to an pdf file workbook.save("AddRowColumnCellType.pdf");
//create a new workbook var workbook = Workbook() val worksheet = workbook.worksheets.get(0) worksheet.columns.get(3).columnWidthInPixel = 100.0 val cellType = CheckBoxCellType() cellType.setCaption("CheckBox") cellType.setTextTrue("True") cellType.setTextFalse("False") cellType.isThreeState = true cellType.textAlign = CheckBoxAlign.Right worksheet.columns.get(3).cellType = cellType worksheet.getRange("D1:D10").setValue(true) val buttonCellType = ButtonCellType() buttonCellType.setText("Button") buttonCellType.setButtonBackColor("Azure") buttonCellType.marginLeft = 10.0 buttonCellType.marginRight = 10.0 worksheet.rows.get(3).cellType = buttonCellType //save to an pdf file workbook.save("AddRowColumnCellType.pdf")