Package pt.utl.ist.fenix.tools.util.excel

Examples of pt.utl.ist.fenix.tools.util.excel.StyledExcelSpreadsheet


    }

    private void exportToXls(Set<RegistrationAcademicServiceRequest> requestList, OutputStream outputStream,
            DegreeByExecutionYearBean degreeSearchBean, DocumentRequestSearchBean requestSearchBean) throws IOException {

        final StyledExcelSpreadsheet spreadsheet =
                new StyledExcelSpreadsheet(getResourceMessage("label.requestByDegree.unspaced"));

        fillSpreadSheetFilters(degreeSearchBean, requestSearchBean, spreadsheet);
        fillSpreadSheetResults(requestList, spreadsheet);
        spreadsheet.getWorkbook().write(outputStream);
    }
View Full Code Here


    }

    private void exportToXls(List<Enrolment> registrations, OutputStream outputStream, ExecutionYear executionYear,
            CurricularCourse curricularCourse, String year, String semester, Boolean detailed) throws IOException {

        final StyledExcelSpreadsheet spreadsheet =
                new StyledExcelSpreadsheet(getResourceMessage("lists.studentByCourse.unspaced"));
        fillSpreadSheetFilters(executionYear, curricularCourse, year, semester, spreadsheet);
        fillSpreadSheetResults(registrations, spreadsheet, executionYear, detailed);
        spreadsheet.getWorkbook().write(outputStream);
    }
View Full Code Here

    public void setExecutionSemester(final ExecutionSemester executionSemester) {
        this.executionSemester = executionSemester;
    }

    public StyledExcelSpreadsheet getInconsistencySpreadsheet() {
        final StyledExcelSpreadsheet spreadsheet =
                new StyledExcelSpreadsheet(BundleUtil.getString(Bundle.ACADEMIC, "label.course.load.inconsistency.filename")
                        + "_" + executionSemester.getExecutionYear().getYear().replace('/', '_') + "_"
                        + executionSemester.getSemester());
        HSSFCellStyle normalStyle = spreadsheet.getExcelStyle().getValueStyle();
        normalStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        HSSFWorkbook wb = spreadsheet.getWorkbook();
        HSSFFont font = wb.createFont();
        font.setColor(HSSFColor.BLACK.index);
        font.setFontHeightInPoints((short) 8);
        HSSFCellStyle redStyle = wb.createCellStyle();
        redStyle.setFont(font);
        redStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        redStyle.setFillForegroundColor(HSSFColor.ORANGE.index);
        redStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        HSSFCellStyle yellowStyle = wb.createCellStyle();
        yellowStyle.setFont(font);
        yellowStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        yellowStyle.setFillForegroundColor(HSSFColor.YELLOW.index);
        yellowStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

        spreadsheet.newHeaderRow();
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.department"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.degree"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.executionCourse"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.shift"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.shiftType"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.load.competenceCourse"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.load.curricularCourse"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.load.executionCourse"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.load.lessonInstances"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.load.lesson.count"));
        spreadsheet.addHeader(BundleUtil.getString(Bundle.ACADEMIC, "label.load.lessonInstances.count"));

        for (final ExecutionCourse executionCourse : executionSemester.getAssociatedExecutionCoursesSet()) {
            for (final CourseLoad courseLoad : executionCourse.getCourseLoadsSet()) {
                for (final Shift shift : courseLoad.getShiftsSet()) {
                    spreadsheet.newRow();
                    spreadsheet.addCell(getDepartmentString(executionCourse));
                    spreadsheet.addCell(executionCourse.getDegreePresentationString());
                    spreadsheet.addCell(executionCourse.getName());
                    spreadsheet.addCell(shift.getNome());
                    spreadsheet.addCell(courseLoad.getType().getFullNameTipoAula());
                    final BigDecimal competenceCourseLoad =
                            new BigDecimal(getCompetenceCourseLoad(courseLoad)).setScale(2, RoundingMode.HALF_EVEN);
                    final BigDecimal curricularCourseLoad =
                            new BigDecimal(getCurricularCourseLoad(courseLoad)).setScale(2, RoundingMode.HALF_EVEN);
                    final BigDecimal executionLoad = courseLoad.getTotalQuantity().setScale(2, RoundingMode.HALF_EVEN);
                    final BigDecimal shiftCourseLoad = getShiftCourseLoad(shift).setScale(2, RoundingMode.HALF_EVEN);
                    if (competenceCourseLoad.signum() < 0) {
                        spreadsheet.addCell(getCompetenceCourseLoadStrings(courseLoad), redStyle);
                    } else {
                        spreadsheet.addCell(competenceCourseLoad);
                    }
                    if (!competenceCourseLoad.equals(curricularCourseLoad) || curricularCourseLoad.signum() < 0) {
                        spreadsheet.addCell(getCurricularCourseLoadString(courseLoad), redStyle);
                    } else {
                        spreadsheet.addCell(curricularCourseLoad);
                    }
                    if (!executionLoad.equals(curricularCourseLoad)) {
                        spreadsheet.addCell(executionLoad, redStyle);
                    } else {
                        spreadsheet.addCell(executionLoad);
                    }
                    if (!shiftCourseLoad.equals(executionLoad)) {
                        if (isLargeDifference(shiftCourseLoad, executionLoad,
                                competenceCourseLoad.divide(new BigDecimal(14), 2, RoundingMode.HALF_EVEN))) {
                            spreadsheet.addCell(shiftCourseLoad, redStyle);
                        } else {
                            spreadsheet.addCell(shiftCourseLoad, yellowStyle);
                        }
                    } else {
                        spreadsheet.addCell(shiftCourseLoad);
                    }
                    spreadsheet.addCell(shift.getAssociatedLessonsSet().size());
                    spreadsheet.addCell(getLessonInstanceCount(shift));
                }
            }
        }

        final HSSFSheet sheet = wb.getSheetAt(0);
View Full Code Here

    }

    private void exportToXls(List<RegistrationWithStateForExecutionYearBean> registrationList, OutputStream outputStream,
            SearchStudentsByDegreeParametersBean searchBean, boolean extendedInfo) throws IOException {

        final StyledExcelSpreadsheet spreadsheet =
                new StyledExcelSpreadsheet(getResourceMessage("lists.studentByDegree.unspaced"));
        fillSpreadSheetFilters(searchBean, spreadsheet);
        fillSpreadSheetResults(registrationList, spreadsheet, searchBean.getExecutionYear(), extendedInfo);
        spreadsheet.getWorkbook().write(outputStream);
    }
View Full Code Here

    public ActionForward downloadInconsistencies(final ActionMapping mapping, final ActionForm form,
            final HttpServletRequest request, final HttpServletResponse response) {
        final ExecutionSemester executionSemester = getDomainObject(request, "executionSemesterOid");
        final CourseLoadOverviewBean bean = new CourseLoadOverviewBean(executionSemester);
        final StyledExcelSpreadsheet spreadsheet = bean.getInconsistencySpreadsheet();

        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-disposition",
                "attachment; filename=" + BundleUtil.getString(Bundle.ACADEMIC, "label.course.load.inconsistency.filename")
                        + ".xls");

        try {
            final ServletOutputStream writer = response.getOutputStream();
            spreadsheet.getWorkbook().write(writer);
            writer.close();
        } catch (final IOException e) {
            throw new Error(e);
        }
View Full Code Here

        return null;
    }

    private void writeReportForInstitutionDegrees(DegreeTransferCandidacyProcess process, ServletOutputStream outputStream)
            throws IOException {
        final StyledExcelSpreadsheet excelSpreadsheet = new StyledExcelSpreadsheet();
        for (final Entry<Degree, SortedSet<DegreeTransferIndividualCandidacyProcess>> entry : process
                .getValidInstitutionIndividualCandidacyProcessesByDegree().entrySet()) {
            createSpreadsheet(excelSpreadsheet, entry.getKey(), entry.getValue());
        }
        excelSpreadsheet.getWorkbook().write(outputStream);

    }
View Full Code Here

        return null;
    }

    private void writeReportForExternalDegrees(DegreeTransferCandidacyProcess process, ServletOutputStream outputStream)
            throws IOException {
        final StyledExcelSpreadsheet excelSpreadsheet = new StyledExcelSpreadsheet();
        for (final Entry<Degree, SortedSet<DegreeTransferIndividualCandidacyProcess>> entry : process
                .getValidExternalIndividualCandidacyProcessesByDegree().entrySet()) {
            createSpreadsheet(excelSpreadsheet, entry.getKey(), entry.getValue());
        }
        excelSpreadsheet.getWorkbook().write(outputStream);
    }
View Full Code Here

        return null;
    }

    private void exportToXls(final Collection<CerimonyInquiryPerson> requests, final OutputStream os) throws IOException {

        final StyledExcelSpreadsheet spreadsheet = new StyledExcelSpreadsheet(getResourceMessage("label.alumni.main.title"));

        fillSpreadSheet(requests, spreadsheet);
        spreadsheet.getWorkbook().write(os);
    }
View Full Code Here

        return null;
    }

    private void writeReportForInstitutionDegrees(final DegreeChangeCandidacyProcess process,
            final ServletOutputStream outputStream) throws IOException {
        final StyledExcelSpreadsheet excelSpreadsheet = new StyledExcelSpreadsheet();
        for (final Entry<Degree, SortedSet<DegreeChangeIndividualCandidacyProcess>> entry : process
                .getValidInstitutionIndividualCandidacyProcessesByDegree().entrySet()) {
            createSpreadsheet(excelSpreadsheet, entry.getKey(), entry.getValue());
        }
        excelSpreadsheet.getWorkbook().write(outputStream);
    }
View Full Code Here

        return null;
    }

    private void writeReportForExternalDegrees(final DegreeChangeCandidacyProcess process, final ServletOutputStream outputStream)
            throws IOException {
        final StyledExcelSpreadsheet excelSpreadsheet = new StyledExcelSpreadsheet();
        for (final Entry<Degree, SortedSet<DegreeChangeIndividualCandidacyProcess>> entry : process
                .getValidExternalIndividualCandidacyProcessesByDegree().entrySet()) {
            createSpreadsheet(excelSpreadsheet, entry.getKey(), entry.getValue());
        }
        excelSpreadsheet.getWorkbook().write(outputStream);
    }
View Full Code Here

TOP

Related Classes of pt.utl.ist.fenix.tools.util.excel.StyledExcelSpreadsheet

Copyright © 2018 www.massapicom. 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.