Example usage for org.apache.poi.ss.usermodel Cell setCellStyle

List of usage examples for org.apache.poi.ss.usermodel Cell setCellStyle

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Cell setCellStyle.

Prototype

void setCellStyle(CellStyle style);

Source Link

Document

Set the style for the cell.

Usage

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.TranslationVerificationReportGenerator.java

License:Apache License

/**
 * Add title to the sheet/*from  w ww .  j  a va  2 s . c o  m*/
 * 
 * @param p_workBook
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception {
    Font titleFont = p_workBook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle cs = p_workBook.createCellStyle();
    cs.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(m_bundle.getString("lb_translation_verification_report"));
    titleCell.setCellStyle(cs);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.TranslationVerificationReportGenerator.java

License:Apache License

/**
 * Add hidden info "TER_taskID" for offline uploading. When upload, system
 * can know the report type and current task ID report generated from.
 * /*w w w .  j a  v  a2  s  . c o  m*/
 * @param p_workbook
 * @param p_sheet
 * @param p_job
 * @param p_targetLocale
 * @throws Exception
 */
private void addHidenInfoForUpload(Workbook p_workbook, Sheet p_sheet, Job p_job,
        GlobalSightLocale p_targetLocale) throws Exception {
    String reportInfo = "";
    for (Workflow wf : p_job.getWorkflows()) {
        if (p_targetLocale.getId() == wf.getTargetLocale().getId()) {
            Collection tasks = ServerProxy.getTaskManager().getCurrentTasks(wf.getId());
            if (tasks != null) {
                for (Iterator it = tasks.iterator(); it.hasNext();) {
                    Task task = (Task) it.next();
                    reportInfo = ReportConstants.TRANSLATIONS_VERIFICATION_REPORT_ABBREVIATION + "_"
                            + task.getId();
                }
            }
        }
    }

    Row titleRow = getRow(p_sheet, 0);
    Cell taskIdCell = getCell(titleRow, 26);
    taskIdCell.setCellValue(reportInfo);
    taskIdCell.setCellStyle(contentStyle);

    p_sheet.setColumnHidden(26, true);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.TranslationVerificationReportGenerator.java

License:Apache License

/**
 * Add segment header to the sheet/*from w ww.  j  av  a  2s  . c om*/
 * 
 * @param p_workBook
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addSegmentHeader(Workbook p_workBook, Sheet p_sheet) throws Exception {
    int col = 0;
    int row = SEGMENT_HEADER_ROW;
    Row segHeaderRow = getRow(p_sheet, row);

    Cell cell_A = getCell(segHeaderRow, col);
    cell_A.setCellValue(m_bundle.getString("lb_source_segment"));
    cell_A.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_B = getCell(segHeaderRow, col);
    cell_B.setCellValue(m_bundle.getString("lb_initial_translation"));
    cell_B.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_C = getCell(segHeaderRow, col);
    cell_C.setCellValue(m_bundle.getString("lb_current_translation"));
    cell_C.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 50 * 256);
    col++;

    Cell cell_D = getCell(segHeaderRow, col);
    cell_D.setCellValue(m_bundle.getString("lb_modify_the_translation"));
    cell_D.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 50 * 256);
    col++;

    Cell cell_E = getCell(segHeaderRow, col);
    cell_E.setCellValue(m_bundle.getString("latest_comments"));
    cell_E.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_F = getCell(segHeaderRow, col);
    cell_F.setCellValue(m_bundle.getString("translation_comments"));
    cell_F.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_G = getCell(segHeaderRow, col);
    cell_G.setCellValue(m_bundle.getString("lb_category_failure"));
    cell_G.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_H = getCell(segHeaderRow, col);
    cell_H.setCellValue(m_bundle.getString("lb_comment_status"));
    cell_H.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 15 * 256);
    col++;

    Cell cell_I = getCell(segHeaderRow, col);
    cell_I.setCellValue(m_bundle.getString("lb_tm_match_original"));
    cell_I.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 20 * 256);
    col++;

    Cell cell_J = getCell(segHeaderRow, col);
    cell_J.setCellValue(m_bundle.getString("lb_glossary_source"));
    cell_J.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 25 * 256);
    col++;

    Cell cell_K = getCell(segHeaderRow, col);
    cell_K.setCellValue(m_bundle.getString("lb_glossary_target"));
    cell_K.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 25 * 256);
    col++;

    Cell cell_L = getCell(segHeaderRow, col);
    cell_L.setCellValue(m_bundle.getString("lb_job_id_report"));
    cell_L.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 15 * 256);
    col++;

    Cell cell_M = getCell(segHeaderRow, col);
    cell_M.setCellValue(m_bundle.getString("lb_segment_id"));
    cell_M.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 15 * 256);
    col++;

    Cell cell_N = getCell(segHeaderRow, col);
    cell_N.setCellValue(m_bundle.getString("lb_page_name"));
    cell_N.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 25 * 256);
    col++;

    Cell cell_O = getCell(segHeaderRow, col);
    cell_O.setCellValue(m_bundle.getString("lb_sid"));
    cell_O.setCellStyle(getHeaderStyle(p_workBook));
    p_sheet.setColumnWidth(col, 15 * 256);
    col++;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.TranslationVerificationReportGenerator.java

License:Apache License

/**
 * For Translations Edit Report, Write segment information into each row of
 * the sheet.//from  www .ja  va 2  s .co m
 * 
 * @param p_sheet
 *            the sheet
 * @param p_jobId
 *            the job id
 * @param p_targetLang
 *            the target locale String
 * @param p_srcPageId
 *            the source page id
 * @param p_dateFormat
 *            the data format
 * @param p_row
 *            the segment row in sheet
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private int writeSegmentInfo(Workbook p_workBook, Sheet p_sheet, Job p_job, GlobalSightLocale p_targetLocale,
        String p_srcPageId, String p_dateFormat, int p_row) throws Exception {
    Vector<TargetPage> targetPages = new Vector<TargetPage>();

    TranslationMemoryProfile tmp = null;
    Vector<String> excludItems = null;

    for (Workflow workflow : p_job.getWorkflows()) {
        if (cancel)
            return 0;

        if (Workflow.PENDING.equals(workflow.getState()) || Workflow.CANCELLED.equals(workflow.getState())
        // || Workflow.EXPORT_FAILED.equals(workflow.getState())
                || Workflow.IMPORT_FAILED.equals(workflow.getState())) {
            continue;
        }
        if (p_targetLocale.getId() == workflow.getTargetLocale().getId()) {
            targetPages = workflow.getTargetPages();
            tmp = workflow.getJob().getL10nProfile().getTranslationMemoryProfile();
            if (tmp != null) {
                excludItems = tmp.getJobExcludeTuTypes();
            }
        }
    }

    if (targetPages.isEmpty()) {
        // If no corresponding target page exists, set the cell blank
        writeBlank(p_sheet, p_row, 11);
    } else {
        LeverageMatchLingManager lmLingManager = LingServerProxy.getLeverageMatchLingManager();
        TermLeverageManager termLeverageManager = ServerProxy.getTermLeverageManager();

        Locale sourcePageLocale = p_job.getSourceLocale().getLocale();
        Locale targetPageLocale = p_targetLocale.getLocale();
        TermLeverageOptions termLeverageOptions = getTermLeverageOptions(sourcePageLocale, targetPageLocale,
                p_job.getL10nProfile().getProject().getTermbaseName(), String.valueOf(p_job.getCompanyId()));
        Map<Long, Set<TermLeverageMatch>> termLeverageMatchResultMap = null;
        if (termLeverageOptions != null) {
            termLeverageMatchResultMap = termLeverageManager.getTermMatchesForPages(p_job.getSourcePages(),
                    p_targetLocale);
        }

        String category = null;
        PseudoData pData = new PseudoData();
        pData.setMode(PseudoConstants.PSEUDO_COMPACT);
        String sid = null;
        Set<Integer> rowsWithCommentSet = new HashSet<Integer>();
        for (int i = 0; i < targetPages.size(); i++) {
            if (cancel)
                return 0;

            TargetPage targetPage = (TargetPage) targetPages.get(i);
            SourcePage sourcePage = targetPage.getSourcePage();

            if (!"".equals(p_srcPageId) && !p_srcPageId.equals(String.valueOf(sourcePage.getId()))) {
                // ignore the source pages not equal to the one
                // if the request comes from pop up editor
                continue;
            }

            SegmentTuUtil.getTusBySourcePageId(sourcePage.getId());
            List sourceTuvs = SegmentTuvUtil.getSourceTuvs(sourcePage);
            List targetTuvs = SegmentTuvUtil.getTargetTuvs(targetPage);

            MatchTypeStatistics tuvMatchTypes = lmLingManager.getMatchTypesForStatistics(
                    sourcePage.getIdAsLong(), targetPage.getLocaleId(), p_job.getLeverageMatchThreshold());
            Map<Long, Set<LeverageMatch>> fuzzyLeverageMatchMap = lmLingManager
                    .getFuzzyMatches(sourcePage.getIdAsLong(), new Long(targetPage.getLocaleId()));
            Map<Long, Tuv> allTuvMap = this.getAllTuvsMap(targetPage);

            sourcePageLocale = sourcePage.getGlobalSightLocale().getLocale();
            targetPageLocale = targetPage.getGlobalSightLocale().getLocale();

            boolean m_rtlSourceLocale = EditUtil.isRTLLocale(sourcePageLocale.toString());
            boolean m_rtlTargetLocale = EditUtil.isRTLLocale(targetPageLocale.toString());

            // Find segment all comments belong to this target page
            Map<Long, IssueImpl> issuesMap = CommentHelper.getIssuesMap(targetPage.getId());

            for (int j = 0; j < targetTuvs.size(); j++) {
                if (cancel)
                    return 0;

                int col = 0;
                Tuv targetTuv = (Tuv) targetTuvs.get(j);
                Tuv sourceTuv = (Tuv) sourceTuvs.get(j);

                category = sourceTuv.getTu(p_job.getId()).getTuType();
                if (excludItems != null && excludItems.contains(category)) {
                    continue;
                }

                // Comment
                List issueHistories = null;
                String lastComment = "";
                String failure = "";
                String commentStatus = "";
                Issue issue = issuesMap.get(targetTuv.getId());
                if (issue != null) {
                    issueHistories = issue.getHistory();
                    failure = issue.getCategory();
                    commentStatus = issue.getStatus();
                }
                if (issueHistories != null && issueHistories.size() > 0) {
                    IssueHistory issueHistory = (IssueHistory) issueHistories.get(0);
                    lastComment = issueHistory.getComment();
                }

                sid = sourceTuv.getSid();

                StringBuilder matches = getMatches(fuzzyLeverageMatchMap, tuvMatchTypes, excludItems,
                        sourceTuvs, targetTuvs, sourceTuv, targetTuv, p_job.getId());

                // Get Terminology/Glossary Source and Target.
                String sourceTerms = "";
                String targetTerms = "";
                if (termLeverageMatchResultMap != null && termLeverageMatchResultMap.size() > 0) {
                    Set<TermLeverageMatch> termLeverageMatchSet = termLeverageMatchResultMap
                            .get(sourceTuv.getId());
                    if (termLeverageMatchSet != null && termLeverageMatchSet.size() > 0) {
                        TermLeverageMatch tlm = termLeverageMatchSet.iterator().next();
                        sourceTerms = tlm.getMatchedSourceTerm();
                        targetTerms = tlm.getMatchedTargetTerm();
                    }
                }

                Row currentRow = getRow(p_sheet, p_row);

                // Source segment with compact tags
                CellStyle srcStyle = m_rtlSourceLocale ? getRtlContentStyle(p_workBook)
                        : getContentStyle(p_workBook);
                Cell cell_A = getCell(currentRow, col);
                cell_A.setCellValue(getSegment(pData, sourceTuv, m_rtlSourceLocale, p_job.getId()));
                cell_A.setCellStyle(srcStyle);
                col++;

                // the translation after the translation activity
                CellStyle trgStyle = null;
                String previousSegments = getPreviousSegments(allTuvMap, targetTuv.getId(), targetTuv,
                        p_job.getId(), pData);
                String currentSegments = getSegment(pData, targetTuv, m_rtlTargetLocale, p_job.getId());
                Cell cell_B = getCell(currentRow, col);
                cell_B.setCellValue(previousSegments);
                if (StringUtil.isNotEmpty(previousSegments) && !previousSegments.endsWith(currentSegments)) {
                    trgStyle = m_rtlTargetLocale ? getRtlContentStyle1(p_workBook)
                            : getContentStyle1(p_workBook);
                } else {
                    trgStyle = m_rtlTargetLocale ? getRtlContentStyle(p_workBook) : getContentStyle(p_workBook);
                }
                cell_B.setCellStyle(trgStyle);
                col++;

                // the translation after the review activity
                // CellStyle trgStyle = m_rtlTargetLocale ?
                // getRtlContentStyle(p_workBook)
                // : getContentStyle(p_workBook);
                Cell cell_C = getCell(currentRow, col);
                cell_C.setCellValue(currentSegments);
                cell_C.setCellStyle(trgStyle);
                col++;

                // Modify the translation
                CellStyle modifyTranslationStyle = m_rtlTargetLocale ? getUnlockedRightStyle(p_workBook)
                        : getUnlockedStyle(p_workBook);
                Cell cell_D = getCell(currentRow, col);
                cell_D.setCellValue("");
                cell_D.setCellStyle(modifyTranslationStyle);
                col++;

                // Reviewers Comments
                Cell cell_E = getCell(currentRow, col);
                cell_E.setCellValue(lastComment);
                cell_E.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Translators Comments
                Cell cell_F = getCell(currentRow, col);
                cell_F.setCellValue("");
                cell_F.setCellStyle(getUnlockedStyle(p_workBook));
                col++;

                // Category failure
                Cell cell_G = getCell(currentRow, col);
                cell_G.setCellValue(failure);
                cell_G.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Comment Status
                Cell cell_H = getCell(currentRow, col);
                cell_H.setCellValue(commentStatus);
                CellStyle commentCS = p_workBook.createCellStyle();
                commentCS.cloneStyleFrom(getContentStyle(p_workBook));
                commentCS.setLocked(false);
                cell_H.setCellStyle(commentCS);
                // add comment status drop down list for current row.
                String[] statusArray = getCommentStatusList(lastComment);
                if (statusArray.length > 1) {
                    rowsWithCommentSet.add(p_row);
                }
                col++;

                // TM match
                Cell cell_I = getCell(currentRow, col);
                cell_I.setCellValue(matches.toString());
                cell_I.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Glossary source
                Cell cell_J = getCell(currentRow, col);
                cell_J.setCellValue(sourceTerms);
                cell_J.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Glossary target
                Cell cell_K = getCell(currentRow, col);
                cell_K.setCellValue(targetTerms);
                cell_K.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Job Id
                Cell cell_L = getCell(currentRow, col);
                cell_L.setCellValue(p_job.getId());
                cell_L.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Segment id
                Cell cell_M = getCell(currentRow, col);
                cell_M.setCellValue(sourceTuv.getTu(p_job.getId()).getId());
                cell_M.setCellStyle(getContentStyle(p_workBook));
                col++;

                // Fix for GBS-1484
                String externalPageId = sourcePage.getExternalPageId();
                String[] pathNames = externalPageId.split("\\\\");
                String name = pathNames[pathNames.length - 1];
                boolean temp = pathNames[0].contains(")");
                if (temp) {
                    String[] firstNames = pathNames[0].split("\\)");
                    String detailName = firstNames[0];
                    name = name + detailName + ")";
                }
                // Page Name
                Cell cell_N = getCell(currentRow, col);
                cell_N.setCellValue(name);
                cell_N.setCellStyle(getContentStyle(p_workBook));
                col++;

                // SID
                Cell cell_O = getCell(currentRow, col);
                cell_O.setCellValue(sid);
                cell_O.setCellStyle(getContentStyle(p_workBook));
                col++;

                p_row++;
            }
        }
        // Add comment status
        addCommentStatus(p_sheet, rowsWithCommentSet, p_row);
        // Add category failure drop down list here.
        addCategoryFailureValidation(p_sheet, SEGMENT_START_ROW, p_row - 1, CATEGORY_FAILURE_COLUMN,
                CATEGORY_FAILURE_COLUMN);
    }

    return p_row;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobAttributeReportHelper.java

License:Apache License

private void addTitle() throws Exception {
    // title font is black bold on white
    Font titleFont = workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle titleStyle = workbook.createCellStyle();
    titleStyle.setFont(titleFont);/*ww  w  .  j a v a2s . c  o m*/

    Row titleRow = getRow(0);
    Cell cell_A = getCell(titleRow, 0);
    cell_A.setCellValue(bundle.getString("lb_job_attributes"));
    cell_A.setCellStyle(titleStyle);
    sheet.setColumnWidth(0, 20 * 256);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobAttributeReportHelper.java

License:Apache License

/**
 * Adds the table header for the Dell Matches sheet
 * //from  w ww . j a v  a2 s.c om
 */
private void addHeader() throws Exception {
    int c = 0;
    Row headerRow = getRow(2);
    for (String header : getHeaders()) {
        Cell cell_Header = getCell(headerRow, c);
        cell_Header.setCellValue(header);
        cell_Header.setCellStyle(getHeaderStyle(false));
        sheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
        setRegionStyle(new CellRangeAddress(2, 3, c, c), headerStyle);
        sheet.setColumnWidth(c, 17 * 256);
        c++;
    }

    for (AttributeItem item : attriutes) {
        CellStyle style = item.isFromSuper() ? getHeaderStyle(true) : getHeaderStyle(false);
        Cell cell_Attriutes = getCell(headerRow, c);
        cell_Attriutes.setCellValue(item.getName());
        cell_Attriutes.setCellStyle(style);
        sheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
        setRegionStyle(new CellRangeAddress(2, 3, c, c), style);
        sheet.setColumnWidth(c, 25 * 256);
        c++;
    }
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobAttributeReportHelper.java

License:Apache License

private void writeData() throws Exception {
    for (JobImpl job : jobAttributes) {
        int col = 0;
        Row theRow = getRow(row);/*from  w  ww . j  a  v a2  s.c  om*/

        // Job Id
        Cell cell_A = getCell(theRow, col++);
        cell_A.setCellValue(job.getId());
        cell_A.setCellStyle(getContentStyle());

        // Job Name
        Cell cell_B = getCell(theRow, col++);
        cell_B.setCellValue(job.getName());
        cell_B.setCellStyle(getContentStyle());

        // Number of Languages
        Cell cell_C = getCell(theRow, col++);
        cell_C.setCellValue(job.getWorkflows().size());
        cell_C.setCellStyle(getContentStyle());

        // Submitter
        Cell cell_D = getCell(theRow, col++);
        cell_D.setCellValue(UserHandlerHelper.getUser(job.getCreateUserId()).getUserName());
        cell_D.setCellStyle(getContentStyle());

        // Project
        Cell cell_E = getCell(theRow, col++);
        cell_E.setCellValue(job.getL10nProfile().getProject().getName());
        cell_E.setCellStyle(getContentStyle());

        for (AttributeItem item : attriutes) {
            JobAttribute jobAtt = getJobAttributeValue(item.getName(), job, item.isFromSuper());

            Cell cell = getCell(theRow, col++);
            if (jobAtt == null) {
                cell.setCellValue(bundle.getString("lb_na"));
                cell.setCellStyle(getContentStyle());
            } else {
                Object ob = jobAtt.getValue();
                if (ob == null) {
                    cell.setCellValue("");
                    cell.setCellStyle(getContentStyle());
                } else {
                    String type = jobAtt.getType();
                    if (Attribute.TYPE_FLOAT.equals(type)) {
                        double value = Double.parseDouble(jobAtt.getFloatValue().toString());
                        cell.setCellValue(value);
                        cell.setCellStyle(getContentStyle());
                        if (item.isTotal()) {
                            addTotalCell(col, row);
                        }
                    } else if (Attribute.TYPE_INTEGER.equals(type)) {
                        cell.setCellValue(jobAtt.getIntegerValue());
                        cell.setCellStyle(getContentStyle());
                        if (item.isTotal()) {
                            addTotalCell(col, row);
                        }
                    } else {
                        cell.setCellValue(getAttributeValueString(jobAtt));
                        cell.setCellStyle(getContentStyle());
                    }
                }
            }
        }

        row++;
    }
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobAttributeReportHelper.java

License:Apache License

private void writeTotal() throws Exception {
    Font totalFont = workbook.createFont();
    totalFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    totalFont.setColor(IndexedColors.BLACK.getIndex());
    totalFont.setUnderline(Font.U_NONE);
    totalFont.setFontName("Arial");
    totalFont.setFontHeightInPoints((short) 9);

    CellStyle totalStyle = workbook.createCellStyle();
    totalStyle.setFont(totalFont);/*  ww  w  .  j  av  a 2s. c  o m*/

    Set<Integer> keys = totalCells.keySet();

    if (keys.size() > 0) {
        row++;
        Cell cell_B = getCell(getRow(row), 1);
        cell_B.setCellValue(bundle.getString("lb_total"));
        cell_B.setCellStyle(totalStyle);

        for (Integer key : keys) {
            Cell cell = getCell(getRow(row), key - 1);
            cell.setCellFormula(getTotalFormula(key, totalCells.get(key)));
            cell.setCellStyle(totalStyle);
        }
    }
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobAttributeReportHelper.java

License:Apache License

public void setRegionStyle(CellRangeAddress cellRangeAddress, CellStyle cs) {
    for (int i = cellRangeAddress.getFirstRow(); i <= cellRangeAddress.getLastRow(); i++) {
        Row row = getRow(i);// ww  w  .  j  a v a2 s.co m
        for (int j = cellRangeAddress.getFirstColumn(); j <= cellRangeAddress.getLastColumn(); j++) {
            Cell cell = getCell(row, j);
            cell.setCellStyle(cs);
        }
    }
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.JobStatusXlsReportProcessor.java

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) {
    String EMEA = CompanyWrapper.getCurrentCompanyName();
    Row titleRow = getRow(p_sheet, 0);// w  w  w. j a va2  s  .c  o m
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(EMEA + " " + bundle.getString("lb_job_status"));
    titleCell.setCellStyle(getTitleStyle(p_workbook));
    p_sheet.setColumnWidth(0, 22 * 256);
}