Java 类org.apache.poi.xssf.usermodel.XSSFCreationHelper 实例源码

项目:owsi-core-parent    文件:UserExcelTableExport.java   
private void populateRow(Row row, User user) {
    UserBinding binding = new UserBinding(user);

    int columnIndex = 0;

    addTextCell(row, columnIndex++, binding.userName().getSafely());
    addTextCell(row, columnIndex++, binding.lastName().getSafely());
    addTextCell(row, columnIndex++, binding.firstName().getSafely());

    XSSFCreationHelper helper= (XSSFCreationHelper) workbook.getCreationHelper();
    XSSFHyperlink emailLink = helper.createHyperlink(Hyperlink.LINK_EMAIL);
    String emailAddress = binding.email().getSafely();
    emailLink.setAddress("mailto:" + emailAddress);
    addLinkToCell(addTextCell(row, columnIndex++, emailAddress), emailLink);

    if (binding.active().getSafely()) {
        addTextCell(row, columnIndex++, "Oui");
    }
    else {
        addTextCell(row, columnIndex++, "Non");
    }

    if (binding.creationDate().getSafely() != null) {
        addDateCell(row, columnIndex++, binding.creationDate().getSafely());
    } else {
        addTextCell(row, columnIndex++, "");
    }

    if (binding.lastUpdateDate().getSafely() != null) {
        addDateCell(row, columnIndex++, binding.lastUpdateDate().getSafely());
    } else {
        addTextCell(row, columnIndex++, "");
    }

    if (binding.lastLoginDate().getSafely() != null) {
        addDateCell(row, columnIndex++, binding.lastLoginDate().getSafely());
    } else {
        addTextCell(row, columnIndex++, "");
    }
}