Examples of HSSFSheet


Examples of org.apache.poi.hssf.usermodel.HSSFSheet

    if (notVisibleColumns != null) {
      notVisibleColumnsSize = notVisibleColumns.size();
    }
    String infoString = "Genererer excel-fil...rad ";
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet;

    sheet = wb.createSheet("sheet");
    int currentRow = 0;
    HSSFRow row;
    HSSFCell cell;

    CellStyle cellStyle = new CellStyle(wb, (short) headFontSize);

    // Overskrift
    if (heading != null && heading.length() != 0) {
      row = sheet.createRow((short) currentRow++);
      createCell(row, cellStyle.getHeadingStyle(), (short) 0, heading);
    }

    // Kolonneoverskrift
    row = sheet.createRow((short) currentRow++);
    int columnCount = table.getColumnCount();
    int rowCount = table.getRowCount();

    // Skriver ut kolonneoverskrift
    createColumnHeadings(row, cellStyle.getHeadingStyle(),
        table.getModel(), 0, columnCount, 0, notVisibleColumns);

    String groupValue = "";
    List<ExcelGroupSum> formulaCells = new ArrayList<ExcelGroupSum>();
    String groupSumValue = "";
    ExcelGroupSum currentExcelGroupSum = null;

    // Data
    int j;
    int k;
    int l = currentRow;
    // G�r gjennom alle rader og kolonner
    for (j = currentRow; j < rowCount + currentRow; j++) {
      // dersom data skal grupperes
      if (groupColumn != null
          && !table.getValueAt(j - currentRow, groupColumn).equals(
              groupValue)) {
        // setter forrige grupperingssum
        if (currentExcelGroupSum != null) {
          currentExcelGroupSum.setToRow((short) (l));
          formulaCells.add(currentExcelGroupSum);
          groupSumValue = "";
          currentExcelGroupSum = null;
        }
        // henter grupperingsverdi og setter ny overskrift for
        // gruppering
        groupValue = (String) table.getValueAt(j - currentRow,
            groupColumn);
        row = sheet.createRow((short) l);
        createCell(row, cellStyle.getGroupStyle(), (short) 0,
            groupValue);
        sheet.addMergedRegion(new Region((short) l, (short) 0,
            (short) l,
            (short) (columnCount - notVisibleColumnsSize - 1)));
        l++;

      }
      setLabelInfo(labelInfo, infoString, j);

      row = sheet.createRow((short) l);
      l++;

      // g�r gjennom alle kolonner for rad
      for (k = 0; k < columnCount; k++) {
        // dersom kolonne skal v�re synlig
        if (notVisibleColumns == null || !notVisibleColumns.contains(k)) {
          // dersom kolonnebredde er satt
          if (colSize != null) {
            Integer columnSize = colSize.get(k);
            if (columnSize != null) {
              sheet.setColumnWidth((short) k, columnSize
                  .shortValue());
            }
          }
          cell = row.createCell((short) k);
          // dersom celle har verdi
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

      final ExcelReportSetting reportSetting,
      final Map<Object, Object> data) throws ProTransException {
    String excelPath = getExcelPath();
    HSSFWorkbook wb = new HSSFWorkbook();

    HSSFSheet sheet = getSheet(wb, 1, new int[] { 4000 });

    int currentRow = 0;
    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle18Bold(), (short) 2, "Avviksrapport");

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle10Bold(), (short) 0, "Avvik m�ned");
    createCell(row, cellStyle.getStyle10Bold(), (short) 1,
        ((ExcelReportSettingDeviation) reportSetting).getMonthEnum()
            .getMonthString());
    createCell(row, cellStyle.getStyle10Bold(), (short) 3, "�r");
    createCell(row, cellStyle.getStyle10Bold(), (short) 4, String
        .valueOf(reportSetting.getYear()));

    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle10Bold(), (short) 0, "Produktgruppe");
    createCell(row, cellStyle.getStyle10Bold(), (short) 1,
        ((ExcelReportSettingDeviation) reportSetting).getProductArea()
            .getProductArea());

    currentRow = createEmptyRows(sheet, currentRow, 2);

    // **
    // **********************************PERIODE***************************************
    // */
    currentRow = generateDeviationSummarySub(wb, sheet, currentRow, data,
        "Period", "Antall Avvik", "Sum", cellStyle);
    // **************************HITTIL I
    // �R***************************************
    currentRow = generateDeviationSummarySub(wb, sheet, currentRow, data,
        "Year", "Avvik hittil i �r", "Sum hittil i �r", cellStyle);

    // **************************SAMMENLIKNING MED I
    // FJOR***************************************
    currentRow = createEmptyRows(sheet, currentRow, 2);
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle10Bold(), (short) 0,
        "(sammenligning med samme periode i fjor)");

    currentRow = generateDeviationSummarySub(wb, sheet, currentRow, data,
        "LastYear", "Antall Avvik", "Sum", cellStyle);

    currentRow = createEmptyRows(sheet, currentRow, 1);
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle10Bold(), (short) 0, "Eventuelt");

    currentRow = createEmptyRows(sheet, currentRow, 13);

    // *************************** AKTIVE TILTAK
    // *****************************
    currentRow = generateDeviationSummaryPreventiveAction(wb, sheet,
        currentRow, data, "PreventiveActionOpen", "Aktive tiltak",
        cellStyle);

    // *************************** LUKKEDE TILTAK
    // *****************************
    currentRow = generateDeviationSummaryPreventiveAction(wb, sheet,
        currentRow, data, "PreventiveActionClosed", "Lukkede tiltak",
        cellStyle);

    currentRow = createEmptyRows(sheet, currentRow, 2);

    row = sheet.createRow((short) currentRow++);

    currentRow = generateDeviationOverview(wb, sheet, currentRow, data,
        cellStyle);

    openExcelFile(reportSetting.getExcelReportType().getExcelFileName()
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

    }
  }

  private HSSFSheet getSheet(final HSSFWorkbook wb,
      final int numberOfColumns, final int[] sizes) {
    HSSFSheet sheet;
    sheet = wb.createSheet("sheet");
    for (int i = 0; i < numberOfColumns; i++) {
      sheet.setColumnWidth((short) i, (short) sizes[i]);
    }

    return sheet;
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

    if (directory == null || directory.length() == 0) {
      throw new ProTransException("Katalog ikke satt");
    }

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("sheet");

    int currentRow = 0;
    int startCell = 0;

    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb, (short) headFontSize);

    // Overskrift
    if (heading != null && heading.length() != 0) {
      row = sheet.createRow((short) currentRow++);
      createCell(row, cellStyle.createStyle((short) headFontSize,
          HSSFFont.BOLDWEIGHT_BOLD, HSSFColor.BLUE_GREY.index,
          HSSFCellStyle.ALIGN_LEFT), (short) startCell, heading);
    }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

  public void generateJiggReport(final ExcelReportSetting reportSetting,
      final Map<Object, Object> data) throws ProTransException {
    String excelPath = getExcelPath();
    HSSFWorkbook wb = new HSSFWorkbook();

    HSSFSheet sheet = getSheet(wb, 1, new int[] { 4000 });

    int currentRow = 0;
    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle18Bold(), (short) 2, "Jiggrapport");

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle10Bold(), (short) 0, "Periode");
    createCell(row, cellStyle.getStyle10Bold(), (short) 1, (reportSetting)
        .getPeriodString());

    Map<String, Map<String, Set<JiggReportData>>> reportData = (Map<String, Map<String, Set<JiggReportData>>>) data
        .get("Rapport");

    Set<String> jigger = reportData.keySet();
    List<String> jiggListe = jigger != null ? new ArrayList<String>(jigger)
        : new ArrayList<String>();
    Collections.sort(jiggListe);

    row = sheet.createRow((short) currentRow++);
    BigDecimal sumOrdreTotal = BigDecimal.ZERO;
    BigDecimal sumInternTotal = BigDecimal.ZERO;
    for (String jigg : jiggListe) {
      row = sheet.createRow((short) currentRow++);
      row = sheet.createRow((short) currentRow++);
      Map<String, Set<JiggReportData>> jiggData = reportData.get(jigg);
      Set<JiggReportData> ordre = jiggData.get("Ordre");
      ordre = ordre != null ? ordre : new HashSet<JiggReportData>();

      Set<JiggReportData> internOrdre = jiggData.get("Intern");
      internOrdre = internOrdre != null ? internOrdre
          : new HashSet<JiggReportData>();
      createCell(row, cellStyle.getStyle10BoldWithTopBorderAndLeftTick(),
          (short) 0, jigg);
      createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(),
          (short) 1, "");
      createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(),
          (short) 2, "");
      createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(),
          (short) 3, "");
      createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(),
          (short) 4, "");
      createCell(row,
          cellStyle.getStyle10BoldWithTopBorderAndRightTick(),
          (short) 5, "");
      row = sheet.createRow((short) currentRow++);
      createCell(row, cellStyle.getStyle10BoldWithBorderLeftTick(),
          (short) 0, "Ordre");
      createCell(row, cellStyle.getStyle10Bold(), (short) 1, "Artikkel");
      createCell(row, cellStyle.getStyle10Bold(), (short) 2, "Start");
      createCell(row, cellStyle.getStyle10Bold(), (short) 3, "Ferdig");
      createCell(row, cellStyle.getStyle10Bold(), (short) 4, "Verdi");
      createCell(row, cellStyle.getStyle10BoldWithBorderRightTick(),
          (short) 5, "Pris");
      row = sheet.createRow((short) currentRow++);
      BigDecimal sumOrdre = BigDecimal.ZERO;
      for (JiggReportData jiggReportData : ordre) {
        createCell(row, cellStyle.getStyle10WithBorderLeftTick(),
            (short) 0, jiggReportData.getOrderInfo());
        createCell(row, cellStyle.getStyle10(), (short) 1,
            jiggReportData.getArticleName());
        createCell(row, cellStyle.getStyle10(), (short) 2, Util
            .formatDate(jiggReportData.getStartDate(), dateFormat));
        createCell(row, cellStyle.getStyle10(), (short) 3, Util
            .formatDate(jiggReportData.getProduced(), dateFormat));
        createCell(row, cellStyle.getStyle10(), (short) 4,
            jiggReportData.getOwnProductionString());
        createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
            null, HSSFCellStyle.BORDER_THICK, null), (short) 5,
            Util.convertBigDecimalToString(jiggReportData
                .getPrice()));
        row = sheet.createRow((short) currentRow++);
        sumOrdre = sumOrdre
            .add(jiggReportData.getOwnProduction() != null ? jiggReportData
                .getOwnProduction()
                : BigDecimal.ZERO);
      }
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(),
          HSSFCellStyle.BORDER_THICK, null, null,
          HSSFCellStyle.BORDER_THIN), (short) 0, "Sum ordre " + jigg);
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 1, "");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 2, "");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 3, "");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 4, Util
          .convertBigDecimalToString(sumOrdre));
      createCell(row, cellStyle
          .getStyle(cellStyle.getFont10(), null, null,
              HSSFCellStyle.BORDER_THICK,
              HSSFCellStyle.BORDER_THIN), (short) 5, "");
      BigDecimal sumIntern = BigDecimal.ZERO;

      row = sheet.createRow((short) currentRow++);
      createCell(row, cellStyle.getStyle10WithBorderLeftTick(),
          (short) 0, "");
      createCell(row, cellStyle.getStyle10BoldWithBorderRightTick(),
          (short) 5, "");
      row = sheet.createRow((short) currentRow++);

      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
          HSSFCellStyle.BORDER_THICK, HSSFCellStyle.BORDER_THIN,
          null, null), (short) 0, "Internordre");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          HSSFCellStyle.BORDER_THIN, null, null), (short) 1,
          "Artikkel");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          HSSFCellStyle.BORDER_THIN, null, null), (short) 2, "Start");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          HSSFCellStyle.BORDER_THIN, null, null), (short) 3, "Ferdig");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          HSSFCellStyle.BORDER_THIN, null, null), (short) 4, "Verdi");
      createCell(row, cellStyle
          .getStyle(cellStyle.getFont10Bold(), null,
              HSSFCellStyle.BORDER_THIN,
              HSSFCellStyle.BORDER_THICK, null), (short) 5,
          "Pris");
      row = sheet.createRow((short) currentRow++);

      for (JiggReportData jiggReportData : internOrdre) {
        createCell(row, cellStyle.getStyle10WithBorderLeftTick(),
            (short) 0, jiggReportData.getOrderInfo());
        createCell(row, cellStyle.getStyle10(), (short) 1,
            jiggReportData.getArticleName());
        createCell(row, cellStyle.getStyle10(), (short) 2, Util
            .formatDate(jiggReportData.getStartDate(), dateFormat));
        createCell(row, cellStyle.getStyle10(), (short) 3, Util
            .formatDate(jiggReportData.getProduced(), dateFormat));
        createCell(row, cellStyle.getStyle10(), (short) 4,
            jiggReportData.getOwnInternalProductionString());
        createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
            null, HSSFCellStyle.BORDER_THICK, null), (short) 5,
            Util.convertBigDecimalToString(jiggReportData
                .getPrice()));
        row = sheet.createRow((short) currentRow++);
        sumIntern = sumIntern.add(jiggReportData
            .getOwnInternalProduction() != null ? jiggReportData
            .getOwnInternalProduction() : BigDecimal.ZERO);
      }
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(),
          HSSFCellStyle.BORDER_THICK, null, null,
          HSSFCellStyle.BORDER_THIN), (short) 0, "Sum intern " + jigg);
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 1, "");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 2, "");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 3, "");

      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, HSSFCellStyle.BORDER_THIN), (short) 4, Util
          .convertBigDecimalToString(sumIntern));
      createCell(row, cellStyle
          .getStyle(cellStyle.getFont10(), null, null,
              HSSFCellStyle.BORDER_THICK,
              HSSFCellStyle.BORDER_THIN), (short) 5, "");
      row = sheet.createRow((short) currentRow++);
      createCell(row, cellStyle.getStyle10WithBorderLeftTick(),
          (short) 0, "");
      createCell(row, cellStyle.getStyle10BoldWithBorderRightTick(),
          (short) 5, "");
      row = sheet.createRow((short) currentRow++);
      createCell(row, cellStyle
          .getStyle10BoldWithBottomBorderAndLeftTick(), (short) 0,
          "Sum " + jigg);
      createCell(row, cellStyle.getStyle10BoldWithBottomBorderTick(),
          (short) 1, "");
      createCell(row, cellStyle.getStyle10BoldWithBottomBorderTick(),
          (short) 2, "");
      createCell(row, cellStyle.getStyle10BoldWithBottomBorderTick(),
          (short) 3, "");
      createCell(row, cellStyle.getStyle10BoldWithBottomBorderTick(),
          (short) 4, Util.convertBigDecimalToString(sumOrdre
              .add(sumIntern)));
      createCell(row, cellStyle
          .getStyle10BoldWithBottomBorderAndRigthTick(), (short) 5,
          "");

      sumOrdreTotal = sumOrdreTotal.add(sumOrdre);
      sumInternTotal = sumInternTotal.add(sumIntern);
    }

    row = sheet.createRow((short) currentRow++);
    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle10BoldWithTopBorderAndLeftTick(),
        (short) 0, "Sum ordre");
    createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(), (short) 1,
        Util.convertBigDecimalToString(sumOrdreTotal));
    createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(), (short) 2,
        "");
    createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(), (short) 3,
        "");
    createCell(row, cellStyle.getStyle10BoldWithTopBorderTick(), (short) 4,
        "");
    createCell(row, cellStyle.getStyle10BoldWithTopBorderAndRightTick(),
        (short) 5, "");
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle10BoldWithBorderLeftTick(),
        (short) 0, "Sum intern");
    createCell(row, cellStyle.getStyle10Bold(), (short) 1, Util
        .convertBigDecimalToString(sumInternTotal));
    createCell(row, cellStyle.getStyle10BoldWithBorderRightTick(),
        (short) 5, "");
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THICK, HSSFCellStyle.BORDER_THIN, null,
        HSSFCellStyle.BORDER_THICK), (short) 0, "Sum total");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, null, HSSFCellStyle.BORDER_THICK),
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

      final ExcelReportSetting reportSetting,
      final Map<Object, Object> data) throws ProTransException {
    String excelPath = getExcelPath();
    HSSFWorkbook wb = new HSSFWorkbook();

    HSSFSheet sheet = getSheet(wb, 1, new int[] { 4000 });

    int currentRow = 0;
    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle18Bold(), (short) 2,
        "Ordrereserve takstol");

    row = sheet.createRow((short) currentRow++);
    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null,
        HSSFCellStyle.BORDER_THIN), (short) 1, "Ekstern");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null,
        HSSFCellStyle.BORDER_THIN), (short) 3, "Intern");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null,
        HSSFCellStyle.BORDER_THIN), (short) 5, "");

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, HSSFCellStyle.BORDER_THIN,
        HSSFCellStyle.BORDER_THICK), (short) 0, "Ordrereserve");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null,
        HSSFCellStyle.BORDER_THICK), (short) 1, "Antall");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, null, HSSFCellStyle.BORDER_THICK),
        (short) 2, "Sum");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null,
        HSSFCellStyle.BORDER_THICK), (short) 3, "Antall");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, null, HSSFCellStyle.BORDER_THICK),
        (short) 4, "Sum");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null,
        HSSFCellStyle.BORDER_THICK), (short) 5, "Totalt");

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, HSSFCellStyle.BORDER_THIN, null), (short) 0,
        "Ikke prosjektert");

    Map<String, AntallSum> reportSum = (Map<String, AntallSum>) data
        .get("Sum");
    AntallSum antallSum = reportSum.get("IkkeProsjektertEkstern");

    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        null, null), (short) 1, null, antallSum != null ? Double
        .valueOf(antallSum.getNumberOf()) : 0);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        HSSFCellStyle.BORDER_THIN, null), (short) 2, null,
        antallSum != null ? Double.valueOf(antallSum.getSum()
            .doubleValue()) : 0);

    antallSum = reportSum.get("IkkeProsjektertIntern");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        null, null), (short) 3, null, antallSum != null ? Double
        .valueOf(antallSum.getNumberOf()) : 0);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        HSSFCellStyle.BORDER_THIN, null), (short) 4, null,
        antallSum != null ? Double.valueOf(antallSum.getSum()
            .doubleValue()) : 0);

    createFormulaCell(row, (short) (5), "C5+E5", null);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, HSSFCellStyle.BORDER_THIN, null), (short) 0,
        "Prosjektert");

    antallSum = reportSum.get("ProsjektertEkstern");

    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        null, null), (short) 1, null, antallSum != null ? Double
        .valueOf(antallSum.getNumberOf()) : 0);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        HSSFCellStyle.BORDER_THIN, null), (short) 2, null,
        antallSum != null ? Double.valueOf(antallSum.getSum()
            .doubleValue()) : 0);

    antallSum = reportSum.get("ProsjektertIntern");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        null, null), (short) 3, null, antallSum != null ? Double
        .valueOf(antallSum.getNumberOf()) : 0);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null, null,
        HSSFCellStyle.BORDER_THIN, null), (short) 4, null,
        antallSum != null ? Double.valueOf(antallSum.getSum()
            .doubleValue()) : 0);

    createFormulaCell(row, (short) (5), "C6+E6", null);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, HSSFCellStyle.BORDER_THIN,
        HSSFCellStyle.BORDER_THICK), (short) 0, "Totalt");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, null, HSSFCellStyle.BORDER_THICK),
        (short) 1, "");
    createFormulaCell(row, (short) (2), "C5+C6", cellStyle.getStyle(
        cellStyle.getFont10(), null, HSSFCellStyle.BORDER_THIN,
        HSSFCellStyle.BORDER_THIN, HSSFCellStyle.BORDER_THICK));
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        HSSFCellStyle.BORDER_THIN, null, HSSFCellStyle.BORDER_THICK),
        (short) 3, "");
    createFormulaCell(row, (short) (4), "E5+E6", cellStyle.getStyle(
        cellStyle.getFont10(), null, HSSFCellStyle.BORDER_THIN,
        HSSFCellStyle.BORDER_THIN, HSSFCellStyle.BORDER_THICK));
    createFormulaCell(row, (short) (5), "F5+F6", cellStyle.getStyle(
        cellStyle.getFont10(), null, HSSFCellStyle.BORDER_THIN, null,
        HSSFCellStyle.BORDER_THICK));

    row = sheet.createRow((short) currentRow++);
    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, null), (short) 0, "Grunnlag");

    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 0, "Type");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 1, "Avdeling");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 2, "Kundenr");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 3, "Navn");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 4, "Ordrenr");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 5,
        "Egenproduksjon");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 6, "Frakt");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 7, "Prod.dato");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, HSSFCellStyle.BORDER_THICK), (short) 8, "Transport");

    List<OrdreReserveTakstol> reportBasis = (List<OrdreReserveTakstol>) data
        .get("Basis");

    row = sheet.createRow((short) currentRow++);

    for (OrdreReserveTakstol ordre : reportBasis) {
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 0, ordre.getType());
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 1, ordre.getProductAreaGroup());
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 2, ordre.getCustomerNr());
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 3, ordre.getCustomerName());
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 4, ordre.getOrderNr());
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 5, null, ordre
          .getOwnProduction() != null ? ordre.getOwnProduction()
          .doubleValue() : 0);
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 6, null,
          ordre.getDeliveryCost() != null ? ordre.getDeliveryCost()
              .doubleValue() : 0);
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 7,
          ordre.getProductionDate() != null ? Util.formatDate(ordre
              .getProductionDate(), Util.SHORT_DATE_FORMAT) : "");
      createCell(row, cellStyle.getStyle(cellStyle.getFont10(), null,
          null, null, null), (short) 8,
          ordre.getTransportWeek() != null ? ""
              + ordre.getTransportYear() + "/"
              + ordre.getTransportWeek() : "");
      row = sheet.createRow((short) currentRow++);
    }

    openExcelFile(reportSetting.getExcelReportType().getExcelFileName()
        + ".xls", excelPath, wb, true);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

      final ExcelReportSetting reportSetting,
      final Map<Object, Object> data) throws ProTransException {
    String excelPath = getExcelPath();
    HSSFWorkbook wb = new HSSFWorkbook();

    HSSFSheet sheet = getSheet(wb, 10, new int[] { 5000, 1000, 5000, 5000,
        5000, 5000, 5000, 5000, 5000, 5000 });

    int currentRow = 0;
    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle18Bold(), (short) 2,
        "Rapport pr funksjonsomr�de - "
            + ((ExcelReportSettingDeviation) reportSetting)
                .getProductAreaGroup()
                .getProductAreaGroupName());

    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle(cellStyle.getFont12Bold(), null,
        null, null, null), (short) 0, "�r:");
    createCell(row, cellStyle.getStyle(cellStyle.getFont12Bold(), null,
        null, null, null), (short) 1, String
        .valueOf(((ExcelReportSettingDeviation) reportSetting)
            .getYear()));
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle(cellStyle.getFont12Bold(), null,
        null, null, null), (short) 0, "Aviksfunksjon:");
    createCell(row, cellStyle.getStyle(cellStyle.getFont12Bold(), null,
        null, null, null), (short) 1,
        ((ExcelReportSettingDeviation) reportSetting)
            .getDeviationFunction().getJobFunctionName());

    row = sheet.createRow((short) currentRow++);
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
        HSSFCellStyle.BORDER_THIN, null, null, null), (short) 2,
        "Kategori");
    row = sheet.createRow((short) currentRow++);
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, null), (short) 0, "M�ned");
    createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
        null, null, null), (short) 1, "Uke");
    Set<String> functionCategories = (Set<String>) data
        .get("FunctionCategory");
    int column = 2;
    for (String functionCategory : functionCategories) {
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
          HSSFCellStyle.BORDER_THIN, null, null,
          HSSFCellStyle.BORDER_THIN), (short) column,
          functionCategory);
      column++;
    }
    row = sheet.createRow((short) currentRow++);

    Map<String, DeviationSumJobFunctionV> reportData = (Map<String, DeviationSumJobFunctionV>) data
        .get("ReportData");
    String lastMonth = "";
    boolean writeMonth = false;
    for (int i = 1; i < 54; i++) {// g�r gjennom alle uker i et �r
      String month = Util.getMonthByWeek(i);
      writeMonth = false;
      if (!month.equalsIgnoreCase(lastMonth)) {
        lastMonth = month;
        writeMonth = true;
        createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(),
            null, HSSFCellStyle.BORDER_THIN, null, null),
            (short) 0, month);
      }
      createCell(row, cellStyle.getStyle(cellStyle.getFont10Bold(), null,
          writeMonth ? HSSFCellStyle.BORDER_THIN : null, null, null),
          (short) 1, String.valueOf(i));

      int countColumn = 2;
      for (String functionCategory : functionCategories) {
        DeviationSumJobFunctionV deviationSum = reportData.get(""
            + ((ExcelReportSettingDeviation) reportSetting)
                .getYear() + "_" + i + "_" + functionCategory);
        if (deviationSum != null) {
          createCell(row, cellStyle.getStyle(cellStyle.getFont10(),
              HSSFCellStyle.BORDER_THIN,
              writeMonth ? HSSFCellStyle.BORDER_THIN : null,
              null, null), (short) countColumn, null, Double
              .valueOf(deviationSum.getCountDeviations()));
        } else {
          createCell(row, cellStyle.getStyle(cellStyle.getFont10(),
              HSSFCellStyle.BORDER_THIN,
              writeMonth ? HSSFCellStyle.BORDER_THIN : null,
              null, null), (short) countColumn, null, Double
              .valueOf(0));
        }
        countColumn++;
      }

      row = sheet.createRow((short) currentRow++);
    }

    openExcelFile(reportSetting.getExcelReportType().getExcelFileName()
        + ".xls", excelPath, wb, true);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

  public void generateSalesGoalReport(ExcelReportSetting reportSetting,
      Map<Object, Object> data) throws ProTransException {
    HSSFWorkbook wb = new HSSFWorkbook();

    HSSFSheet sheet = getSheet(wb, 21, new int[] { 5000, 6000, 5000, 5000,
        5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000,
        5000, 5000, 5000, 5000, 5000, 5000, 5000 }

    );

    int currentRow = 0;
    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb);

    currentRow = createEmptyRows(sheet, currentRow, 2);
    row = sheet.createRow((short) currentRow++);

    currentRow = createHeadings(reportSetting, sheet, currentRow, row,
        cellStyle);

    Collection<SalesmanGoal> dataList = (Collection<SalesmanGoal>) data
        .get("Reportdata");
    String currentProductAreaName = "";
    for (SalesmanGoal goal : dataList) {
      row = sheet.createRow((short) currentRow++);
      String productAreaName = goal.getProductArea().getProductArea();
      if (!currentProductAreaName.equalsIgnoreCase(productAreaName)) {
        currentProductAreaName = productAreaName;
      } else {
        productAreaName = "";
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

    ImmutableMap<String, Integer> productAreaColumns = new ImmutableMap.Builder<String, Integer>()
        .put("Takstol", 1).put("Garasje", 3).put("Byggelement", 5)
        .build();
    HSSFWorkbook wb = new HSSFWorkbook();

    HSSFSheet sheet = getSheet(wb, 21, new int[] { 5000, 6000, 5000, 5000,
        5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000,
        5000, 5000, 5000, 5000, 5000, 5000, 5000 }

    );

    int currentRow = 0;
    HSSFRow row;

    CellStyle cellStyle = new CellStyle(wb);

    // currentRow = createEmptyRows(sheet, currentRow, 2);
    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle((short) 12,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, null, null), (short) 0, "Takstoltegning uke "
        + reportSetting.getWeekFrom() + " - "
        + reportSetting.getWeekTo() + " " + reportSetting.getYear());

    currentRow = createEmptyRows(sheet, currentRow, 2);

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, null, null), (short) 1, "Takstol");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, null, null), (short) 3, "Garasje");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, null, null), (short) 5, "Byggelement");

    row = sheet.createRow((short) currentRow++);

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 0,
        "Tegner");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 1,
        "Antall");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 2,
        "Sum");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 3,
        "Antall");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 4,
        "Sum");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 5,
        "Antall");

    createCell(row, cellStyle.getStyle((short) 10,
        HSSFFont.BOLDWEIGHT_BOLD, HSSFCellStyle.ALIGN_LEFT, (short) -1,
        null, null, null, HSSFCellStyle.BORDER_THIN, null), (short) 6,
        "Sum");

    Map<TakstoltegnerVSum, Collection<TakstoltegnerV>> dataList = (Map<TakstoltegnerVSum, Collection<TakstoltegnerV>>) data
        .get("Reportdata");
    currentRow = createSumLines(productAreaColumns, sheet, currentRow,
        cellStyle, dataList);
    currentRow = createBasisHeading(sheet, currentRow, cellStyle);
    row = sheet.createRow((short) currentRow++);
    int column = 0;
    for (Collection<TakstoltegnerV> tegnerListe : dataList.values()) {
      for (TakstoltegnerV tegner : tegnerListe) {
        column = 0;
        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, tegner.getTrossDrawer());
        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, tegner.getOrderNr());
        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, tegner.getCustomerName());

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, null, tegner.getCustomerNr()
                .doubleValue());

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, tegner.getPostalCode());

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, null, tegner.getCostAmount()
                .doubleValue());

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, Util.SHORT_DATE_FORMAT.format(tegner
                .getTrossReady()));

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, null,
            tegner.getTakProsjektering() != null ? tegner
                .getTakProsjektering().doubleValue() : 0);

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, null,
            tegner.getMaxTrossHeight() != null ? tegner
                .getMaxTrossHeight().doubleValue() : 0);

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, null, tegner.getProbability()
                .doubleValue());

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, tegner.getProductAreaGroupName());

        createCell(
            row,
            cellStyle.getStyle((short) 10,
                HSSFFont.BOLDWEIGHT_NORMAL,
                HSSFCellStyle.ALIGN_LEFT, (short) -1, null,
                null, null, null, null),
            (short) column++,
            tegner.getPacklistReady() != null ? Util.SHORT_DATE_FORMAT
                .format(tegner.getPacklistReady())
                : "");

        createCell(row, cellStyle.getStyle((short) 10,
            HSSFFont.BOLDWEIGHT_NORMAL, HSSFCellStyle.ALIGN_LEFT,
            (short) -1, null, null, null, null, null),
            (short) column++, tegner.getSalesman());

        row = sheet.createRow((short) currentRow++);

      }
    }

    openExcelFile(reportSetting.getExcelReportType().getExcelFileName()
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet

   */
  public static HSSFWorkbook output(String sheetName,
      String[] columnPropterties, String[] columnNames, List<?> list)
  {
    HSSFWorkbook workbook = new HSSFWorkbook();
    HSSFSheet sheet = workbook.createSheet(sheetName);
    // 创建第1行,也就是输出表头
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell;
    for (int i = 0; i < columnNames.length; i++)
    {
      cell = row.createCell(i);
      cell.setCellValue(new HSSFRichTextString(columnNames[i]));
    }
    // 下面是输出各行的数据
    for (int i = 0; i < list.size(); i++)
    {
      row = sheet.createRow(i + 1);
      Object o = list.get(i);
      for (int j = 0; j < columnPropterties.length; j++)
      {
        cell = row.createCell(j);
        Object obj = ReflectionUtils.invokeGetterMethod(o, columnPropterties[j]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.