Пример #1
1
  /**
   * ************************************************************************* Public methods
   * ************************************************************************
   */
  @Override
  public void open(String filepath) throws Exception {

    this.filepath = filepath;
    String author = ini.getValue("Excel", "Author", "Toël Hartmann");
    String keywords = ini.getValue("Excel", "Keywords", "");

    wb = new HSSFWorkbook();
    // Set some properties
    wb.createInformationProperties();
    wb.getSummaryInformation().setAuthor(author);
    wb.getSummaryInformation().setKeywords(keywords);
    wb.getSummaryInformation().setCreateDateTime(new Date());

    // Create the cell style for column titles
    titleStyle = wb.createCellStyle();
    HSSFFont font = wb.createFont();
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    titleStyle.setFont(font);

    String sheetName = getConfigValue("Excel", "sheet", null);
    if (sheetName == null || sheetName.isEmpty())
      sheetName = FileUtils.getFileNameWithoutExtention(filepath);
    sheet = wb.createSheet(sheetName);
    if (getConfigValue("Excel", "freezeFirstRow", "true").equalsIgnoreCase("true")) {
      sheet.createFreezePane(0, 1);
    }
  }