Ejemplo n.º 1
0
  public void newTrainingFile(String filename, Training training) throws IOException {

    // create new training file
    newTrainingFile(filename, training.language());

    // and reopen it
    Workbook wb = TrainingReaderExcel.openWorkBook(filename);
    trainingSheet = wb.getSheet(ls.NameTrainingSheet());

    // create new rows and fill them with modules
    Iterator<String> it = training.getModules().keySet().iterator();
    // Iterator<TrainingModule> it = training.getModules().iterator();
    while (it.hasNext()) {
      writeModule(training.getModules().get(it.next()));
    }

    // write and close
    save(filename, wb);
  }
Ejemplo n.º 2
0
  /**
   * Creates a new excel-file and creates the title colons. Be careful: if file already exists it
   * will be overridden!!
   *
   * @param filename
   */
  public void newTrainingFile(String filename, String language) throws IOException {

    // create new file
    Workbook wb = new HSSFWorkbook();

    ls = LanguageSupportFactory.getLanguageSupport("en");

    // create info and training sheet
    infoSheet = wb.createSheet(LanguageSupportFactory.getInfoSheetName());
    trainingSheet = wb.createSheet(ls.NameTrainingSheet());

    // add version info
    // Create a row and put some cells in it. Rows are 0 based.
    Row row = infoSheet.createRow(0);
    // Create a cell and put a value in it.
    row.createCell(0).setCellValue("Version:");
    row.createCell(1).setCellValue(this.VERSION);

    row = infoSheet.createRow(1);
    row.createCell(0).setCellValue("Language:");
    row.createCell(1).setCellValue(this.LANGUAGE);

    // add training titles
    row = trainingSheet.createRow(0);
    row.createCell(COL_MODULE_NUMBER).setCellValue(ls.ModuleNumberTitle());
    row.createCell(COL_MODULE).setCellValue(ls.ModuleTitle());
    row.createCell(COL_TOPIC).setCellValue(ls.TopicTitle());
    row.createCell(COL_ACTION).setCellValue(ls.ActionTitle());
    row.createCell(COL_DURATION_ACTION).setCellValue(ls.DurationActionTitle());
    row.createCell(COL_SELECTED).setCellValue(ls.SelectedTitle());
    row.createCell(COL_DURATION_TOPIC).setCellValue(ls.DurationTopicTitle());
    row.createCell(COL_DURATION_MOUDLE).setCellValue(ls.DurationModuleTitle());
    row.createCell(COL_TARGET_GROUPS).setCellValue(ls.TargetGroupsTitle());
    row.createCell(COL_DURATION_TRAINING).setCellValue(ls.DurationTrainingTitle());

    save(filename, wb);
  }