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

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

Introduction

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

Prototype

void setCellValue(boolean value);

Source Link

Document

Set a boolean value for the cell

Usage

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

License:Apache License

/**
 * Create workbook name areas for category failure drop down list, it is
 * from "AA8" to "AAn".//  w ww .  ja v  a2  s  .co  m
 * <P>
 * Only write the data of drop down list into the first sheet as it can be
 * referenced from all sheets.
 * </P>
 * <P>
 * The formula is like
 * "[sheetName]!$AA$[startRow]:$AA$[endRow]",i.e."TER!$AA$8:$AA$32".
 * </P>
 */
private void createCategoryFailureNameArea(Workbook p_workbook) {
    try {
        Sheet firstSheet = getSheet(p_workbook, 0);
        List<String> categories = getFailureCategoriesList();
        // Set the categories in "AA" column, starts with row 8.
        int col = 26;
        for (int i = 0; i < categories.size(); i++) {
            Row row = getRow(firstSheet, SEGMENT_START_ROW + i);
            Cell cell = getCell(row, col);
            cell.setCellValue(categories.get(i));
        }

        String formula = firstSheet.getSheetName() + "!$AA$" + (SEGMENT_START_ROW + 1) + ":$AA$"
                + (SEGMENT_START_ROW + categories.size());
        Name name = p_workbook.createName();
        name.setRefersToFormula(formula);
        name.setNameName(CATEGORY_FAILURE_DROP_DOWN_LIST);

        // Hide "AA" column
        firstSheet.setColumnHidden(26, true);
    } catch (Exception e) {
        logger.error("Error when create hidden area for category failures.", e);
    }
}

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

License:Apache License

/**
 * Add segment header to the sheet for Implemented Comments Check Report
 * //w  w w  . 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);
    CellStyle headerStyle = getHeaderStyle(p_workBook);

    Cell cell_A = getCell(segHeaderRow, col);
    cell_A.setCellValue(bundle.getString("lb_job_id_report"));
    cell_A.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_B = getCell(segHeaderRow, col);
    cell_B.setCellValue(bundle.getString("lb_segment_id"));
    cell_B.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_C = getCell(segHeaderRow, col);
    cell_C.setCellValue(bundle.getString("lb_page_name"));
    cell_C.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_D = getCell(segHeaderRow, col);
    cell_D.setCellValue(bundle.getString("lb_source_segment"));
    cell_D.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_E = getCell(segHeaderRow, col);
    cell_E.setCellValue(bundle.getString("lb_target_segment"));
    cell_E.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_F = getCell(segHeaderRow, col);
    cell_F.setCellValue(bundle.getString("lb_sid"));
    cell_F.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_G = getCell(segHeaderRow, col);
    cell_G.setCellValue(bundle.getString("lb_comment_free"));
    cell_G.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 40 * 256);
    col++;

    Cell cell_H = getCell(segHeaderRow, col);
    cell_H.setCellValue(bundle.getString("lb_category_failure"));
    cell_H.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_I = getCell(segHeaderRow, col);
    cell_I.setCellValue(bundle.getString("lb_tm_match_original"));
    cell_I.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_J = getCell(segHeaderRow, col);
    cell_J.setCellValue(bundle.getString("lb_glossary_source"));
    cell_J.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
    col++;

    Cell cell_K = getCell(segHeaderRow, col);
    cell_K.setCellValue(bundle.getString("lb_glossary_target"));
    cell_K.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 30 * 256);
}

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

License:Apache License

/**
 * Add title to the sheet/*from w  ww .  java  2s  . c  om*/
 * 
 * @param p_workBook
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception {
    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(bundle.getString("implemented_comments_check_report"));
    titleCell.setCellStyle(getTitleStyle(p_workBook));
}

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

License:Apache License

/**
 * For Implemented Comments Check Report, Write segment information into each row of
 * the sheet.//w  w  w  .ja v a  2 s .c om
 * 
 * @param p_workBook
 *            the workBook
 * @param p_sheet
 *            the sheet
 * @param p_job
 *            the job data for report
 * @param p_targetLocale
 *            the target locale
 * @param p_dateFormat
 *            the dateFormat
 * @param p_row
 *            the segment row in sheet
 * @throws Exception
 */
@SuppressWarnings("unchecked")
private int writeSegmentInfo(Workbook p_workBook, Sheet p_sheet, Job p_job, GlobalSightLocale p_targetLocale,
        String p_dateFormat, int p_row) throws Exception {
    Vector<TargetPage> targetPages = new Vector<TargetPage>();

    long companyId = p_job.getCompanyId();

    TranslationMemoryProfile tmp = p_job.getL10nProfile().getTranslationMemoryProfile();
    List<String> excludItems = null;
    if (tmp != null) {
        excludItems = new ArrayList<String>(tmp.getJobExcludeTuTypes());
    }

    for (Workflow workflow : p_job.getWorkflows()) {
        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()) {
            p_targetLocale = workflow.getTargetLocale();
            targetPages = workflow.getTargetPages();
        }
    }
    if (targetPages.isEmpty()) {
        if (SEGMENT_START_ROW == p_row) {
            writeBlank(p_workBook, p_sheet, SEGMENT_START_ROW, 10);
        }
    } else {
        LeverageMatchLingManager leverageMatchLingManager = LingServerProxy.getLeverageMatchLingManager();
        TermLeverageManager termLeverageManager = ServerProxy.getTermLeverageManager();
        Locale sourcePageLocale = p_job.getSourceLocale().getLocale();
        Locale targetPageLocale = p_targetLocale.getLocale();
        Map<Long, Set<TermLeverageMatch>> termLeverageMatchResultMap = termLeverageManager
                .getTermMatchesForPages(p_job.getSourcePages(), p_targetLocale);

        TargetPage targetPage = null;
        SourcePage sourcePage = null;
        String sourceSegmentString = null;
        String targetSegmentString = null;
        String sid = null;
        for (int i = 0; i < targetPages.size(); i++) {
            targetPage = (TargetPage) targetPages.get(i);
            sourcePage = targetPage.getSourcePage();
            SegmentTuUtil.getTusBySourcePageId(sourcePage.getId());
            List sourceTuvs = SegmentTuvUtil.getSourceTuvs(sourcePage);
            List targetTuvs = SegmentTuvUtil.getTargetTuvs(targetPage);

            // Leverage TM
            Map<Long, LeverageSegment> exactMatches = leverageMatchLingManager
                    .getExactMatches(sourcePage.getIdAsLong(), targetPage.getLocaleId());
            Map<Long, Set<LeverageMatch>> fuzzyLeverageMatcheMap = leverageMatchLingManager
                    .getFuzzyMatches(sourcePage.getIdAsLong(), targetPage.getLocaleId());

            // Find segment comments
            Map<Long, IssueImpl> issuesMap = CommentHelper.getIssuesMap(targetPage.getId());
            if (issuesMap.isEmpty()) {
                continue;
            }
            sourcePageLocale = sourcePage.getGlobalSightLocale().getLocale();
            targetPageLocale = targetPage.getGlobalSightLocale().getLocale();
            boolean rtlSourceLocale = EditUtil.isRTLLocale(sourcePageLocale.toString());
            boolean rtlTargetLocale = EditUtil.isRTLLocale(targetPageLocale.toString());

            String category = null;
            for (int j = 0; j < targetTuvs.size(); j++) {
                int col = 0;
                Tuv targetTuv = (Tuv) targetTuvs.get(j);
                Tuv sourceTuv = (Tuv) sourceTuvs.get(j);
                sourceSegmentString = sourceTuv.getGxmlElement().getTextValue();
                targetSegmentString = targetTuv.getGxmlElement().getTextValue();
                sid = sourceTuv.getSid();
                Date targetSegmentModifiedDate = targetTuv.getLastModified();

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

                StringBuilder matches = getMatches(exactMatches, fuzzyLeverageMatcheMap, targetTuv, sourceTuv);

                List<IssueHistory> issueHistories = new ArrayList<IssueHistory>();
                String lastComment = "";
                String failure = "";
                Date issueCreatedDate = null;
                Issue issue = issuesMap.get(targetTuv.getId());

                if (issue != null) {
                    issueHistories = issue.getHistory();
                    failure = issue.getCategory();
                }
                if (issueHistories != null && issueHistories.size() > 0) {
                    IssueHistory issueHistory = (IssueHistory) issueHistories.get(0);
                    lastComment = issueHistory.getComment();
                    issueCreatedDate = issueHistory.dateReportedAsDate();
                }
                if ("".equals(lastComment)) {
                    continue;
                }
                String sourceTerms = "";
                String targetTerms = "";
                if (termLeverageMatchResultMap != null) {
                    Set<TermLeverageMatch> termLeverageMatchSet = termLeverageMatchResultMap
                            .get(sourceTuv.getId());
                    if (termLeverageMatchSet != null) {
                        TermLeverageMatch tlm = termLeverageMatchSet.iterator().next();
                        sourceTerms = tlm.getMatchedSourceTerm();
                        targetTerms = tlm.getMatchedTargetTerm();
                    }
                }

                CellStyle contentStyle = getContentStyle(p_workBook);
                Row currentRow = getRow(p_sheet, p_row);
                // Set color format for target segment changed
                if (targetSegmentModifiedDate.before(issueCreatedDate)) {
                    contentStyle = getRedStyle(p_workBook);
                }
                // Job id
                Cell cell_A = getCell(currentRow, col);
                cell_A.setCellValue(p_job.getId());
                cell_A.setCellStyle(contentStyle);
                col++;

                // Segment id
                Cell cell_B = getCell(currentRow, col);
                cell_B.setCellValue(sourceTuv.getTu(companyId).getId());
                cell_B.setCellStyle(contentStyle);
                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_C = getCell(currentRow, col);
                cell_C.setCellValue(Name);
                cell_C.setCellStyle(contentStyle);
                col++;

                // Source segment
                CellStyle srcStyle = rtlSourceLocale ? getRtlContentStyle(p_workBook) : contentStyle;
                String srcContent = rtlSourceLocale ? EditUtil.toRtlString(sourceSegmentString)
                        : sourceSegmentString;
                Cell cell_D = getCell(currentRow, col);
                cell_D.setCellValue(srcContent);
                cell_D.setCellStyle(srcStyle);
                col++;

                // Target segment
                CellStyle trgStyle = rtlTargetLocale ? getRtlContentStyle(p_workBook) : contentStyle;
                String content = rtlTargetLocale ? EditUtil.toRtlString(targetSegmentString)
                        : targetSegmentString;
                Cell cell_E = getCell(currentRow, col);
                cell_E.setCellValue(content);
                cell_E.setCellStyle(trgStyle);
                col++;

                // Sid
                Cell cell_F = getCell(currentRow, col);
                cell_F.setCellValue(sid);
                cell_F.setCellStyle(contentStyle);
                col++;

                //comment
                CellStyle commentStyle = rtlTargetLocale ? getUnlockedRightStyle(p_workBook)
                        : getUnlockedStyle(p_workBook);
                // Set color format for target segment changed
                if (targetSegmentModifiedDate.before(issueCreatedDate)) {
                    commentStyle = rtlTargetLocale ? getRedRightStyle(p_workBook) : getRedStyle(p_workBook);
                }
                if (rtlTargetLocale) {
                    lastComment = EditUtil.toRtlString(lastComment);
                }
                Cell cell_G = getCell(currentRow, col);
                cell_G.setCellValue(lastComment);
                cell_G.setCellStyle(commentStyle);
                col++;

                // Category failure
                CellStyle cfStyle = getUnlockedStyle(p_workBook);
                // Set color format for target segment changed
                if (targetSegmentModifiedDate.before(issueCreatedDate)) {
                    cfStyle = getRedStyle(p_workBook);
                }
                Cell cell_H = getCell(currentRow, col);
                cell_H.setCellValue(failure);
                cell_H.setCellStyle(cfStyle);
                col++;

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

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

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

                p_row++;
            }

            SegmentTuTuvCacheManager.clearCache();
            sourceTuvs = null;
            targetTuvs = null;
            exactMatches = null;
            fuzzyLeverageMatcheMap = null;
            issuesMap = null;
        }
        // Add category failure drop down list here.
        addCategoryFailureValidation(p_sheet, SEGMENT_START_ROW, p_row, CATEGORY_FAILURE_COLUMN,
                CATEGORY_FAILURE_COLUMN);

        termLeverageMatchResultMap = null;
    }

    return p_row;
}

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

License:Apache License

/**
 * Set the cell blank//from w  w  w  . jav a2 s .c  o  m
 * 
 * @param p_sheet
 *            the sheet
 * @param p_row
 *            the row position
 * @param p_colLen
 *            the blank column length
 * @throws Exception
 */
private void writeBlank(Workbook p_workbook, Sheet p_sheet, int p_row, int p_colLen) throws Exception {
    for (int col = 0; col < p_colLen; col++) {
        Row row = getRow(p_sheet, p_row);
        Cell cell = getCell(row, col++);
        cell.setCellValue("");
    }
}

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

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    String EMEA = CompanyWrapper.getCurrentCompanyName();
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setWrapText(false);// w w  w. j  av a2  s  .co m
    titleStyle.setFont(titleFont);

    Row firRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(firRow, 0);
    titleCell.setCellValue(EMEA + " " + m_bundle.getString("online_jobs_for_ip_translator"));
    titleCell.setCellStyle(titleStyle);
    p_sheet.setColumnWidth(0, 20 * 256);
}

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

License:Apache License

private void addHeader(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory) throws Exception {
    String EMEA = CompanyWrapper.getCurrentCompanyName();
    int col = -1;
    Row thirRow = getRow(p_sheet, 2);/*from w  w  w.  j  a v a 2 s .  c  o m*/
    Row fourRow = getRow(p_sheet, 3);
    // Company Name
    Cell cell_A = getCell(thirRow, ++col);
    cell_A.setCellValue(m_bundle.getString("lb_company_name"));
    cell_A.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));
    // Project Description
    Cell cell_B = getCell(thirRow, ++col);
    cell_B.setCellValue(m_bundle.getString("lb_project"));
    cell_B.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    // For "Add Job Id into online job report" issue
    if (isJobIdVisible) {
        Cell cell_C = getCell(thirRow, ++col);
        cell_C.setCellValue(m_bundle.getString("lb_job_id"));
        cell_C.setCellStyle(getHeaderStyle(p_workbook));
        p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));
    }

    Cell cell_CorD = getCell(thirRow, ++col);
    cell_CorD.setCellValue(m_bundle.getString("lb_job_name"));
    cell_CorD.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_DorE = getCell(thirRow, ++col);
    cell_DorE.setCellValue(m_bundle.getString("lb_source_file_format"));
    cell_DorE.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_EorF = getCell(thirRow, ++col);
    cell_EorF.setCellValue(m_bundle.getString("lb_loc_profile"));
    cell_EorF.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_MTPro = getCell(thirRow, ++col);
    cell_MTPro.setCellValue(m_bundle.getString("lb_mt_translation_name"));
    cell_MTPro.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_ForG = getCell(thirRow, ++col);
    cell_ForG.setCellValue(m_bundle.getString("lb_file_profiles"));
    cell_ForG.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_GorH = getCell(thirRow, ++col);
    cell_GorH.setCellValue(m_bundle.getString("lb_creation_date"));
    cell_GorH.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_HorI = getCell(thirRow, ++col);
    cell_HorI.setCellValue(m_bundle.getString("lb_creation_time"));
    cell_HorI.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_IorJ = getCell(thirRow, ++col);
    cell_IorJ.setCellValue(m_bundle.getString("lb_export_date"));
    cell_IorJ.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_JorK = getCell(thirRow, ++col);
    cell_JorK.setCellValue(m_bundle.getString("lb_export_time"));
    cell_JorK.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_KorL = getCell(thirRow, ++col);
    cell_KorL.setCellValue(m_bundle.getString("lb_status"));
    cell_KorL.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_LorM = getCell(thirRow, ++col);
    cell_LorM.setCellValue(m_bundle.getString("lb_lang"));
    cell_LorM.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_MorN_Header = getCell(thirRow, ++col);
    cell_MorN_Header.setCellValue(m_bundle.getString("lb_word_counts"));
    cell_MorN_Header.setCellStyle(getHeaderStyle(p_workbook));

    if (m_data.useInContext) {
        p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 5));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 5), getHeaderStyle(p_workbook));
    } else {
        p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 4));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 4), getHeaderStyle(p_workbook));
    }

    Cell cell_MorN = getCell(fourRow, col);
    cell_MorN.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.internalreps"));
    cell_MorN.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_NorO = getCell(fourRow, col);
    cell_NorO.setCellValue(m_bundle.getString("lb_100_exact_matches"));
    cell_NorO.setCellStyle(getHeaderStyle(p_workbook));

    if (m_data.useInContext) {
        col++;
        Cell cell_InContext = getCell(fourRow, col);
        cell_InContext.setCellValue(m_bundle.getString("lb_in_context_tm"));
        cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
    }

    col++;
    Cell cell_FuzzyMatches = getCell(fourRow, col);
    cell_FuzzyMatches.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.fuzzymatches"));
    cell_FuzzyMatches.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_NewWords = getCell(fourRow, col);
    cell_NewWords.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.newwords"));
    cell_NewWords.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_Total = getCell(fourRow, col);
    cell_Total.setCellValue(m_bundle.getString("lb_total_source_word_count"));
    cell_Total.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_Invoice = getCell(thirRow, col);
    cell_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice"));
    cell_Invoice.setCellStyle(getHeaderStyle(p_workbook));

    if (p_sheetCategory == MONTH_SHEET) {
        if (m_data.useInContext) {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 7));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 7), getHeaderStyle(p_workbook));
        } else {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 6));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 6), getHeaderStyle(p_workbook));
        }

        Cell cell_InternalReps = getCell(fourRow, col);
        cell_InternalReps.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.internalreps"));
        cell_InternalReps.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_ExactMatches = getCell(fourRow, col);
        cell_ExactMatches.setCellValue(m_bundle.getString("lb_100_exact_matches"));
        cell_ExactMatches.setCellStyle(getHeaderStyle(p_workbook));
        col++;
        if (m_data.useInContext) {
            Cell cell_InContext = getCell(fourRow, col);
            cell_InContext.setCellValue(m_bundle.getString("lb_in_context_tm"));
            cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
            col++;
        }

        Cell cell_FM_Invoice = getCell(fourRow, col);
        cell_FM_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.fuzzymatches"));
        cell_FM_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_NW_Invoice = getCell(fourRow, col);
        cell_NW_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.newwords"));
        cell_NW_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_Total_Invoice = getCell(fourRow, col);
        cell_Total_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.total"));
        cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_AdditionalCharges = getCell(fourRow, col);
        cell_AdditionalCharges.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.additionalCharges"));
        cell_AdditionalCharges.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_JobTotal = getCell(fourRow, col);
        cell_JobTotal.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.jobtotal"));
        cell_JobTotal.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_Tracking = getCell(thirRow, col);
        cell_Tracking.setCellValue(
                m_bundle.getString("lb_tracking") + " " + EMEA + " " + m_bundle.getString("lb_use") + ")");
        cell_Tracking.setCellStyle(getHeaderStyle(p_workbook));

        p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    } else if (p_sheetCategory == MONTH_REVIEW_SHEET) {
        if (m_data.useInContext) {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 7));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 7), getHeaderStyle(p_workbook));
        } else {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 6));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 6), getHeaderStyle(p_workbook));
        }

        Cell cell_InternalReps = getCell(fourRow, col);
        cell_InternalReps.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.internalreps"));
        cell_InternalReps.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_ExactMatches = getCell(fourRow, col);
        cell_ExactMatches.setCellValue(m_bundle.getString("lb_100_exact_matches"));
        cell_ExactMatches.setCellStyle(getHeaderStyle(p_workbook));
        col++;
        if (m_data.useInContext) {
            Cell cell_InContext = getCell(fourRow, col);
            cell_InContext.setCellValue(m_bundle.getString("lb_in_context_tm"));
            cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
            col++;
        }

        Cell cell_FM_Invoice = getCell(fourRow, col);
        cell_FM_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.fuzzymatches"));
        cell_FM_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_NW_Invoice = getCell(fourRow, col);
        cell_NW_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.newwords"));
        cell_NW_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_Total_Invoice = getCell(fourRow, col);
        cell_Total_Invoice.setCellValue(m_bundle.getString("lb_translation_total"));
        cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_Review = getCell(fourRow, col);
        cell_Review.setCellValue(m_bundle.getString("lb_review"));
        cell_Review.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_JobTotal = getCell(fourRow, col);
        cell_JobTotal.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.jobtotal"));
        cell_JobTotal.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_Tracking = getCell(thirRow, col);
        cell_Tracking.setCellValue(
                m_bundle.getString("lb_tracking") + " " + EMEA + " " + m_bundle.getString("lb_use") + ")");
        cell_Tracking.setCellStyle(getHeaderStyle(p_workbook));

        p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));
    } else {
        // Should never go here.
    }
}

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

License:Apache License

/**
 * For trados style/* w  w w . j  a  v a 2 s .  c om*/
 * 
 * @param p_sheet
 * @param p_sheetCategory
 * @param p_data
 * @param bundle
 * @throws Exception
 */
private void addHeaderTradosStyle(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory)
        throws Exception {
    String EMEA = CompanyWrapper.getCurrentCompanyName();

    Row secRow = getRow(p_sheet, 1);
    Cell cell_Ldfl = getCell(secRow, 0);
    cell_Ldfl.setCellValue(m_bundle.getString("lb_desp_file_list"));
    cell_Ldfl.setCellStyle(getContentStyle(p_workbook));

    int col = -1;
    Row thirRow = getRow(p_sheet, 2);
    Row fourRow = getRow(p_sheet, 3);
    // Company Name
    Cell cell_A = getCell(thirRow, ++col);
    cell_A.setCellValue(m_bundle.getString("lb_company_name"));
    cell_A.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    // Project Description
    Cell cell_B = getCell(thirRow, ++col);
    cell_B.setCellValue(m_bundle.getString("lb_project"));
    cell_B.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    if (isJobIdVisible) {
        Cell cell_C = getCell(thirRow, ++col);
        cell_C.setCellValue(m_bundle.getString("lb_job_id"));
        cell_C.setCellStyle(getHeaderStyle(p_workbook));
        p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));
    }

    Cell cell_CorD = getCell(thirRow, ++col);
    cell_CorD.setCellValue(m_bundle.getString("lb_job_name"));
    cell_CorD.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_DorE = getCell(thirRow, ++col);
    cell_DorE.setCellValue(m_bundle.getString("lb_source_file_format"));
    cell_DorE.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_EorF = getCell(thirRow, ++col);
    cell_EorF.setCellValue(m_bundle.getString("lb_loc_profile"));
    cell_EorF.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_MTPro = getCell(thirRow, ++col);
    cell_MTPro.setCellValue(m_bundle.getString("lb_mt_translation_name"));
    cell_MTPro.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_ForG = getCell(thirRow, ++col);
    cell_ForG.setCellValue(m_bundle.getString("lb_file_profiles"));
    cell_ForG.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_GorH = getCell(thirRow, ++col);
    cell_GorH.setCellValue(m_bundle.getString("lb_creation_date"));
    cell_GorH.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_HorI = getCell(thirRow, ++col);
    cell_HorI.setCellValue(m_bundle.getString("lb_creation_time"));
    cell_HorI.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_IorJ = getCell(thirRow, ++col);
    cell_IorJ.setCellValue(m_bundle.getString("lb_export_date"));
    cell_IorJ.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_JorK = getCell(thirRow, ++col);
    cell_JorK.setCellValue(m_bundle.getString("lb_export_time"));
    cell_JorK.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_KorL = getCell(thirRow, ++col);
    cell_KorL.setCellValue(m_bundle.getString("lb_status"));
    cell_KorL.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_LorM = getCell(thirRow, ++col);
    cell_LorM.setCellValue(m_bundle.getString("lb_lang"));
    cell_LorM.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_MorN_Header = getCell(thirRow, ++col);
    cell_MorN_Header.setCellValue(m_bundle.getString("lb_word_counts"));
    cell_MorN_Header.setCellStyle(getHeaderStyle(p_workbook));

    if (m_data.useInContext) {
        p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 8));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 8), getHeaderStyle(p_workbook));
    } else {
        p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 7));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 7), getHeaderStyle(p_workbook));
    }

    Cell cell_MorN = getCell(fourRow, col);
    cell_MorN.setCellValue(m_bundle.getString("jobinfo.tradosmatches.invoice.per100matches"));
    cell_MorN.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_NorO = getCell(fourRow, col);
    cell_NorO.setCellValue(m_bundle.getString("lb_95_99"));
    cell_NorO.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_OorP = getCell(fourRow, col);
    cell_OorP.setCellValue(m_bundle.getString("lb_85_94"));
    cell_OorP.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_PorQ = getCell(fourRow, col);
    cell_PorQ.setCellValue(m_bundle.getString("lb_75_84") + "*");
    cell_PorQ.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_QorR = getCell(fourRow, col);
    cell_QorR.setCellValue(m_bundle.getString("lb_no_match"));
    cell_QorR.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_RorS = getCell(fourRow, col);
    cell_RorS.setCellValue(m_bundle.getString("lb_repetition_word_cnt"));
    cell_RorS.setCellStyle(getHeaderStyle(p_workbook));

    if (m_data.useInContext) {
        col++;
        Cell cell_InContext = getCell(fourRow, col);
        cell_InContext.setCellValue(m_bundle.getString("lb_in_context_tm"));
        cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
    }

    col++;
    Cell cell_MT = getCell(fourRow, col);
    cell_MT.setCellValue(m_bundle.getString("lb_tm_mt"));
    cell_MT.setCellStyle(getHeaderStyle(p_workbook));

    col++;
    Cell cell_Total = getCell(fourRow, col);
    cell_Total.setCellValue(m_bundle.getString("lb_total"));
    cell_Total.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_Score = getCell(thirRow, ++col);
    cell_Score.setCellValue(m_bundle.getString("lb_tm_mt_confidence_score"));
    cell_Score.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    Cell cell_Count = getCell(thirRow, ++col);
    cell_Count.setCellValue(m_bundle.getString("lb_tm_mt_engine_word_counts"));
    cell_Count.setCellStyle(getHeaderStyle(p_workbook));
    p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
    setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    col++;
    Cell cell_Invoice = getCell(thirRow, col);
    cell_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice"));
    cell_Invoice.setCellStyle(getHeaderStyle(p_workbook));

    if (p_sheetCategory == MONTH_SHEET) {
        if (m_data.useInContext) {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 9));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 9), getHeaderStyle(p_workbook));
        } else {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 8));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 8), getHeaderStyle(p_workbook));
        }

        Cell cell_Per100Matches = getCell(fourRow, col);
        cell_Per100Matches.setCellValue(m_bundle.getString("jobinfo.tradosmatches.invoice.per100matches"));
        cell_Per100Matches.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_95_99 = getCell(fourRow, col);
        cell_95_99.setCellValue(m_bundle.getString("lb_95_99"));
        cell_95_99.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_85_94 = getCell(fourRow, col);
        cell_85_94.setCellValue(m_bundle.getString("lb_85_94"));
        cell_85_94.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_75_84 = getCell(fourRow, col);
        cell_75_84.setCellValue(m_bundle.getString("lb_75_84") + "*");
        cell_75_84.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_NoMatch = getCell(fourRow, col);
        cell_NoMatch.setCellValue(m_bundle.getString("lb_no_match"));
        cell_NoMatch.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_WordCount = getCell(fourRow, col);
        cell_WordCount.setCellValue(m_bundle.getString("lb_repetition_word_cnt"));
        cell_WordCount.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        if (m_data.useInContext) {
            Cell cell_InContext = getCell(fourRow, col);
            cell_InContext.setCellValue(m_bundle.getString("lb_in_context_tm"));
            cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
            col++;
        }

        Cell cell_Total_Invoice = getCell(fourRow, col);
        cell_Total_Invoice.setCellValue(m_bundle.getString("jobinfo.tmmatches.wordcounts.total"));
        cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_AdditionalCharges = getCell(fourRow, col);
        cell_AdditionalCharges.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.additionalCharges"));
        cell_AdditionalCharges.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_JobTotal = getCell(fourRow, col);
        cell_JobTotal.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.jobtotal"));
        cell_JobTotal.setCellStyle(getHeaderStyle(p_workbook));
        col++;

        Cell cell_Tracking = getCell(thirRow, col);
        cell_Tracking.setCellValue(
                m_bundle.getString("lb_tracking") + " " + EMEA + " " + m_bundle.getString("lb_use") + ")");
        cell_Tracking.setCellStyle(getHeaderStyle(p_workbook));

        p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));

    } else if (p_sheetCategory == MONTH_REVIEW_SHEET) {
        if (m_data.useInContext) {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 9));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 9), getHeaderStyle(p_workbook));
        } else {
            p_sheet.addMergedRegion(new CellRangeAddress(2, 2, col, col + 7));
            setRegionStyle(p_sheet, new CellRangeAddress(2, 2, col, col + 7), getHeaderStyle(p_workbook));
        }

        Cell cell_Per100Matches = getCell(fourRow, col);
        cell_Per100Matches.setCellValue(m_bundle.getString("jobinfo.tradosmatches.invoice.per100matches"));
        cell_Per100Matches.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_95_99 = getCell(fourRow, col);
        cell_95_99.setCellValue(m_bundle.getString("lb_95_99"));
        cell_95_99.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_85_94 = getCell(fourRow, col);
        cell_85_94.setCellValue(m_bundle.getString("lb_85_94"));
        cell_85_94.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_75_84 = getCell(fourRow, col);
        cell_75_84.setCellValue(m_bundle.getString("lb_75_84"));
        cell_75_84.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_NoMatch = getCell(fourRow, col);
        cell_NoMatch.setCellValue(m_bundle.getString("lb_no_match"));
        cell_NoMatch.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_WoerCount = getCell(fourRow, col);
        cell_WoerCount.setCellValue(m_bundle.getString("lb_repetition_word_cnt"));
        cell_WoerCount.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        if (m_data.useInContext) {
            Cell cell_InContext = getCell(fourRow, col);
            cell_InContext.setCellValue(m_bundle.getString("lb_in_context_tm"));
            cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
            col++;
        }

        Cell cell_TranTotal = getCell(fourRow, col);
        cell_TranTotal.setCellValue(m_bundle.getString("lb_translation_total"));
        cell_TranTotal.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_Review = getCell(fourRow, col);
        cell_Review.setCellValue(m_bundle.getString("lb_review"));
        cell_Review.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_JobTotal = getCell(fourRow, col);
        cell_JobTotal.setCellValue(m_bundle.getString("jobinfo.tmmatches.invoice.jobtotal"));
        cell_JobTotal.setCellStyle(getHeaderStyle(p_workbook));

        col++;
        Cell cell_Tracking = getCell(thirRow, col);
        cell_Tracking.setCellValue(
                m_bundle.getString("lb_tracking") + " " + EMEA + " " + m_bundle.getString("lb_use") + ")");
        cell_Tracking.setCellStyle(getHeaderStyle(p_workbook));
        p_sheet.addMergedRegion(new CellRangeAddress(2, 3, col, col));
        setRegionStyle(p_sheet, new CellRangeAddress(2, 3, col, col), getHeaderStyle(p_workbook));
    } else {
        // Should never go here.
    }
}

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

License:Apache License

private void writeProjectData(HashMap<String, HashMap<String, ProjectWorkflowData>> p_projectMap,
        Workbook p_workbook, Sheet[] p_sheets, boolean p_includeExReview, IntHolder[] p_rows) throws Exception {
    ArrayList<String> keys = new ArrayList<String>(p_projectMap.keySet());
    SortUtil.sort(keys);// ww  w. java2  s. c o m
    Iterator<String> keysIter = keys.iterator();
    totalCost.clear();
    totalCostDate.clear();
    int finishedJobNum = 0;

    while (keysIter.hasNext()) {
        // Cancel generate reports.
        if (isCancelled())
            return;
        // Sets Reports Percent.
        setPercent(++finishedJobNum);
        String key = keysIter.next();
        String jobId = getJobIdFromMapKey(key);
        boolean isWrongJob = m_data.wrongJobNames.contains(jobId);
        HashMap<String, ProjectWorkflowData> localeMap = p_projectMap.get(key);
        ArrayList<String> locales = new ArrayList<String>(localeMap.keySet());
        SortUtil.sort(locales);
        Iterator<String> localeIter = locales.iterator();
        BigDecimal projectTotalWordCountCost = new BigDecimal(BIG_DECIMAL_ZERO_STRING);
        BigDecimal reviewTotalWordCountCost = new BigDecimal(BIG_DECIMAL_ZERO_STRING);

        // Counts the review costing total and the translation costing
        // total.
        String localeName = null;
        ProjectWorkflowData data = null;

        // Marks whether needs to add a blank line.
        boolean containsDellReview = false;

        while (localeIter.hasNext()) {
            int col = 0;
            localeName = (String) localeIter.next();
            data = (ProjectWorkflowData) localeMap.get(localeName);

            int row = p_rows[MONTH_SHEET].getValue();
            Row theRow = getRow(p_sheets[MONTH_SHEET], row);

            CellStyle temp_moneyStyle = getMoneyStyle(p_workbook);
            CellStyle temp_normalStyle = getContentStyle(p_workbook);

            if (data.wasExportFailed) {
                temp_moneyStyle = getFailedMoneyStyle(p_workbook);
                temp_normalStyle = getRedCellStyle(p_workbook);
            }

            // Company Name
            Cell cell_A = getCell(theRow, col++);
            cell_A.setCellValue(data.companyName);
            cell_A.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);

            // Project Description
            Cell cell_B = getCell(theRow, col++);
            cell_B.setCellValue(data.projectDesc);
            cell_B.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 22 * 256);

            if (isWrongJob) {
                // For "Add Job Id into online job report" issue
                if (isJobIdVisible) {
                    Cell cell_C = getCell(theRow, col++);
                    cell_C.setCellValue(Long.valueOf(jobId));
                    cell_C.setCellStyle(getWrongJobStyle(p_workbook));
                }

                Cell cell_CorD = getCell(theRow, col++);
                cell_CorD.setCellValue(data.jobName);
                cell_CorD.setCellStyle(getWrongJobStyle(p_workbook));
            } else {
                // For "Add Job Id into online job report" issue
                if (isJobIdVisible) {
                    Cell cell_C = getCell(theRow, col++);
                    cell_C.setCellValue(Long.valueOf(jobId));
                    cell_C.setCellStyle(temp_normalStyle);
                }
                Cell cell_CorD = getCell(theRow, col++);
                cell_CorD.setCellValue(data.jobName);
                cell_CorD.setCellStyle(temp_normalStyle);
            }
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 50 * 256);

            Cell cell_DorE = getCell(theRow, col++);
            cell_DorE.setCellValue(getAllSouceFileFormats(data.allFileProfiles));
            cell_DorE.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            Cell cell_EorF = getCell(theRow, col++);
            cell_EorF.setCellValue(data.l10nProfileName);
            cell_EorF.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 25 * 256);

            Cell cell_MTPro = getCell(theRow, col++);
            cell_MTPro.setCellValue(data.mtProfile);
            cell_MTPro.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            Cell cell_ForG = getCell(theRow, col++);
            cell_ForG.setCellValue(data.fileProfileNames);
            cell_ForG.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            if (data.wasExportFailed) {
                Cell cell_GorH = getCell(theRow, col++);
                cell_GorH.setCellValue(data.creationDate);
                cell_GorH.setCellStyle(getFailedDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);
                Cell cell_HorI = getCell(theRow, col++);
                cell_HorI.setCellValue(data.creationDate);
                cell_HorI.setCellStyle(getFailedTimeStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);
                Cell cell_IorJ = getCell(theRow, col++);
                cell_IorJ.setCellValue("");
                cell_IorJ.setCellStyle(getFailedDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);
                Cell cell_JorK = getCell(theRow, col++);
                cell_JorK.setCellValue("");
                cell_JorK.setCellStyle(getFailedTimeStyle(p_workbook));
            } else {
                Cell cell_GorH = getCell(theRow, col++);
                cell_GorH.setCellValue(getDateFormat().format(data.creationDate));
                cell_GorH.setCellStyle(getDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);
                Cell cell_HorI = getCell(theRow, col++);
                cell_HorI.setCellValue(getTimeFormat().format(data.creationDate));
                cell_HorI.setCellStyle(getContentStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);
                Cell cell_IorJ = getCell(theRow, col++);
                if (data.wasExported) {
                    cell_IorJ.setCellValue(getDateFormat().format(data.exportDate));
                } else {
                    cell_IorJ.setCellValue("");
                }
                cell_IorJ.setCellStyle(getDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);
                String labelExportTime = "";
                if (data.wasExported) {
                    labelExportTime = getExportDateStr(getTimeFormat(), data.exportDate);
                }
                Cell cell_JorK = getCell(theRow, col++);
                cell_JorK.setCellValue(labelExportTime);
                cell_JorK.setCellStyle(getContentStyle(p_workbook));

            }
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);

            // Status
            Cell cell_KorL = getCell(theRow, col++);
            cell_KorL.setCellValue(data.status);
            cell_KorL.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);
            // Language
            Cell cell_LorM = getCell(theRow, col++);
            cell_LorM.setCellValue(data.targetLang);
            cell_LorM.setCellStyle(temp_normalStyle);
            int numwidth = 10;
            // Summary Start Collumn
            m_data.initSumStartCol(col);
            Cell cell_MorN = getCell(theRow, col++);
            cell_MorN.setCellValue(data.repetitionWordCount);
            cell_MorN.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_NorO = getCell(theRow, col++);
            cell_NorO.setCellValue(data.segmentTmWordCount);
            cell_NorO.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            if (m_data.useInContext) {
                Cell cell_InContext = getCell(theRow, col++);
                cell_InContext.setCellValue(data.inContextMatchWordCount);
                cell_InContext.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);
            }

            Cell cell_FuzzyMatch = getCell(theRow, col++);
            cell_FuzzyMatch.setCellValue(data.fuzzyMatchWordCount);
            cell_FuzzyMatch.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_NoMatch = getCell(theRow, col++);
            cell_NoMatch.setCellValue(data.noMatchWordCount);
            cell_NoMatch.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_TotalWordCount = getCell(theRow, col++);
            cell_TotalWordCount.setCellValue(data.totalWordCount);
            cell_TotalWordCount.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            int moneywidth = 12;
            Cell cell_RepetitionWordCountCost = getCell(theRow, col++);
            cell_RepetitionWordCountCost.setCellValue(asDouble(data.repetitionWordCountCost));
            cell_RepetitionWordCountCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_SegmentTmWordCountCost = getCell(theRow, col++);
            cell_SegmentTmWordCountCost.setCellValue(asDouble(data.segmentTmWordCountCost));
            cell_SegmentTmWordCountCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);
            if (m_data.useInContext) {
                Cell cell_InContext = getCell(theRow, col++);
                cell_InContext.setCellValue(asDouble(data.inContextMatchWordCountCost));
                cell_InContext.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);
            }

            Cell cell_FuzzyMatchCost = getCell(theRow, col++);
            cell_FuzzyMatchCost.setCellValue(asDouble(data.fuzzyMatchWordCountCost));
            cell_FuzzyMatchCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_NoMatchCost = getCell(theRow, col++);
            cell_NoMatchCost.setCellValue(asDouble(data.noMatchWordCountCost));
            cell_NoMatchCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);
            if (totalCol == null) {
                totalCol = ReportUtil.toChar(col);
            }
            Cell cell_TotalCost = getCell(theRow, col++);
            cell_TotalCost.setCellValue(asDouble(data.totalWordCountCost));
            cell_TotalCost.setCellStyle(temp_moneyStyle);

            // Show total additional charges
            // p_sheets[MONTH_SHEET].setColumnView(col - 1, moneywidth);
            // p_sheets[MONTH_SHEET].addCell(new Number(col++, row,
            // asDouble(data.totalAdditionalCost), temp_moneyFormat));

            // p_sheets[MONTH_SHEET].setColumnView(col - 1, moneywidth);
            projectTotalWordCountCost = projectTotalWordCountCost.add(data.totalWordCountCost);

            List<Integer> indexs = totalCost.get(data.targetLang);
            if (indexs == null) {
                indexs = new ArrayList<Integer>();
                totalCost.put(data.targetLang, indexs);
            }
            indexs.add(row + 1);

            Double value = totalCostDate.get(data.targetLang);
            if (value == null) {
                value = 0.0;
            }
            value += asDouble(data.totalWordCountCost);
            totalCostDate.put(data.targetLang, value);

            // add a "project total" summary cost over the locales
            // map(1,moneyFormat)
            if (localeIter.hasNext() == false) {
                Cell cell_TotalAdditionalCost = getCell(theRow, col++);
                cell_TotalAdditionalCost.setCellValue(asDouble(data.totalAdditionalCost));
                cell_TotalAdditionalCost.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                Cell cell_ProjectTotalCost = getCell(theRow, col++);
                cell_ProjectTotalCost
                        .setCellValue(asDouble(projectTotalWordCountCost) + asDouble(data.totalAdditionalCost));
                cell_ProjectTotalCost.setCellStyle(temp_moneyStyle);
            } else {
                Cell cell_TotalAdditionalCost = getCell(theRow, col++);
                cell_TotalAdditionalCost.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                Cell cell_ProjectTotalCost = getCell(theRow, col++);
                cell_ProjectTotalCost.setCellStyle(temp_moneyStyle);
            }
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);
            p_rows[MONTH_SHEET].inc();

            // Write data into MONTH_REVIEW_SHEET
            if (p_includeExReview && data.containsDellReview) {
                containsDellReview = true;

                row = p_rows[MONTH_REVIEW_SHEET].getValue();
                theRow = getRow(p_sheets[MONTH_REVIEW_SHEET], row);
                col = 0;

                // Company Name
                Cell cell_A_Review = getCell(theRow, col++);
                cell_A_Review.setCellValue(data.companyName);
                cell_A_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);

                // Project Description
                Cell cell_B_Review = getCell(theRow, col++);
                cell_B_Review.setCellValue(data.projectDesc);
                cell_B_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 22 * 256);

                if (isWrongJob) {
                    // For "Job id not showing in external review tabs"
                    // Issue
                    if (isJobIdVisible) {
                        Cell cell_C_Review = getCell(theRow, col++);
                        cell_C_Review.setCellValue(data.jobId);
                        cell_C_Review.setCellStyle(getWrongJobStyle(p_workbook));
                    }
                    Cell cell_CorD_Review = getCell(theRow, col++);
                    cell_CorD_Review.setCellValue(data.jobName);
                    cell_CorD_Review.setCellStyle(getWrongJobStyle(p_workbook));
                } else {
                    // For "Job id not showing in external review tabs"
                    // Issue
                    if (isJobIdVisible) {
                        Cell cell_C_Review = getCell(theRow, col++);
                        cell_C_Review.setCellValue(data.jobId);
                        cell_C_Review.setCellStyle(temp_normalStyle);
                    }
                    Cell cell_CorD_Review = getCell(theRow, col++);
                    cell_CorD_Review.setCellValue(data.jobName);
                    cell_CorD_Review.setCellStyle(temp_normalStyle);
                }
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 50 * 256);
                Cell cell_DorE_Review = getCell(theRow, col++);
                cell_DorE_Review.setCellValue(data.projectDesc);
                cell_DorE_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 22 * 256);

                if (data.wasExportFailed) {
                    /*
                     * p_sheets[MONTH_SHEET].addCell(new DateTime(col++,
                     * row, data.creationDate, failed_dateFormat));
                     */
                    Cell cell_EorF_Review = getCell(theRow, col++);
                    cell_EorF_Review.setCellValue(data.creationDate);
                    cell_EorF_Review.setCellStyle(getFailedDateStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);
                    Cell cell_ForG_Review = getCell(theRow, col++);
                    cell_ForG_Review.setCellValue(data.creationDate);
                    cell_ForG_Review.setCellStyle(getFailedTimeStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 18 * 256);
                    Cell cell_GorH_Review = getCell(theRow, col++);
                    cell_GorH_Review.setCellValue("");
                    cell_GorH_Review.setCellStyle(getFailedDateStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);
                    Cell cell_HorI_Review = getCell(theRow, col++);
                    cell_HorI_Review.setCellValue("");
                    cell_HorI_Review.setCellStyle(getFailedTimeStyle(p_workbook));
                } else {
                    /*
                     * p_sheets[MONTH_SHEET].addCell(new Label(col++, row,
                     * dateFormat.format(data.creationDate)));
                     */
                    Cell cell_EorF_Review = getCell(theRow, col++);
                    cell_EorF_Review.setCellValue(getDateFormat().format(data.creationDate));
                    cell_EorF_Review.setCellStyle(getContentStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);
                    Cell cell_ForG_Review = getCell(theRow, col++);
                    cell_ForG_Review.setCellValue(getTimeFormat().format(data.creationDate));
                    cell_ForG_Review.setCellStyle(getContentStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 18 * 256);
                    String labelExportDate = "";
                    if (data.wasExported) {
                        labelExportDate = getExportDateStr(getDateFormat(), data.exportDate);
                    }
                    Cell cell_GorH_Review = getCell(theRow, col++);
                    cell_GorH_Review.setCellValue(labelExportDate);
                    cell_GorH_Review.setCellStyle(getContentStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);
                    String labelExportTime = "";
                    if (data.wasExported) {
                        labelExportTime = getExportDateStr(getTimeFormat(), data.exportDate);
                    }
                    Cell cell_HorI_Review = getCell(theRow, col++);
                    cell_HorI_Review.setCellValue(labelExportTime);
                    cell_HorI_Review.setCellStyle(getContentStyle(p_workbook));

                }
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 18 * 256);
                Cell cell_IorJ_Review = getCell(theRow, col++);
                cell_IorJ_Review.setCellValue(data.targetLang);
                cell_IorJ_Review.setCellStyle(temp_normalStyle);

                Cell cell_JorK_Review = getCell(theRow, col++);
                cell_JorK_Review.setCellValue(data.repetitionWordCount);
                cell_JorK_Review.setCellStyle(temp_normalStyle);

                numwidth = 10;
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);
                Cell cell_KorL_Review = getCell(theRow, col++);
                cell_KorL_Review.setCellValue(data.segmentTmWordCount);
                cell_KorL_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                if (m_data.useInContext) {
                    Cell cell_InContext = getCell(theRow, col++);
                    cell_InContext.setCellValue(data.inContextMatchWordCount);
                    cell_InContext.setCellStyle(temp_normalStyle);
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);
                }

                Cell cell_FuzzyMatch_Review = getCell(theRow, col++);
                cell_FuzzyMatch_Review.setCellValue(data.fuzzyMatchWordCount);
                cell_FuzzyMatch_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                Cell cell_NoMatch_Review = getCell(theRow, col++);
                cell_NoMatch_Review.setCellValue(data.noMatchWordCount);
                cell_NoMatch_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                Cell cell_Total_Review = getCell(theRow, col++);
                cell_Total_Review.setCellValue(data.totalWordCount);
                cell_Total_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                moneywidth = 12;
                Cell cell_RepetitionCost_Review = getCell(theRow, col++);
                cell_RepetitionCost_Review.setCellValue(asDouble(data.repetitionWordCountCostForDellReview));
                cell_RepetitionCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                Cell cell_SegmentCost_Review = getCell(theRow, col++);
                cell_SegmentCost_Review.setCellValue(asDouble(data.segmentTmWordCountCostForDellReview));
                cell_SegmentCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                if (m_data.useInContext) {
                    Cell cell_InContext = getCell(theRow, col++);
                    cell_InContext.setCellValue(asDouble(data.inContextMatchWordCountCostForDellReview));
                    cell_InContext.setCellStyle(temp_moneyStyle);
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                }

                Cell cell_FuzzyMatchCost_Review = getCell(theRow, col++);
                cell_FuzzyMatchCost_Review.setCellValue(asDouble(data.fuzzyMatchWordCountCostForDellReview));
                cell_FuzzyMatchCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                Cell cell_NoMatchCost_Review = getCell(theRow, col++);
                cell_NoMatchCost_Review.setCellValue(asDouble(data.noMatchWordCountCostForDellReview));
                cell_NoMatchCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                reviewTotalWordCountCost = reviewTotalWordCountCost.add(data.totalWordCountCostForDellReview);

                // Writes the "Translation Total" column.
                Cell cell_TotalCost_Review = getCell(theRow, col++);
                cell_TotalCost_Review.setCellValue(asDouble(data.totalWordCountCost));
                cell_TotalCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                // Writes the "Review" column.
                Cell cell_Review = getCell(theRow, col++);
                cell_Review.setCellValue(asDouble(data.totalWordCountCostForDellReview));
                cell_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                // add "job total" cost over the locales
                if (localeIter.hasNext() == false) {
                    Cell cell_JobTotal = getCell(theRow, col++);
                    cell_JobTotal
                            .setCellValue(asDouble(projectTotalWordCountCost.add(reviewTotalWordCountCost)));
                    cell_JobTotal.setCellStyle(temp_moneyStyle);
                } else {
                    Cell cell_JobTotal = getCell(theRow, col++);
                    cell_JobTotal.setCellStyle(temp_moneyStyle);
                }
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                p_rows[MONTH_REVIEW_SHEET].inc();
            } // End if (p_includeExReview && data.containsDellReview)
        } // End loop while (localeIter.hasNext())

        p_rows[MONTH_SHEET].inc();
        if (p_includeExReview && containsDellReview) {
            p_rows[MONTH_REVIEW_SHEET].inc();
        }

    } // End loop while (projectIter.hasNext())

    p_rows[MONTH_SHEET].inc();
    addTotals(p_workbook, p_sheets[MONTH_SHEET], MONTH_SHEET, p_rows[MONTH_SHEET]);

    if (p_includeExReview) {
        p_rows[MONTH_REVIEW_SHEET].inc();
        addTotals(p_workbook, p_sheets[MONTH_REVIEW_SHEET], MONTH_REVIEW_SHEET, p_rows[MONTH_REVIEW_SHEET]);
    }

    if (totalCol != null) {
        addTotalsPerLang(p_workbook, p_sheets[MONTH_SHEET], MONTH_SHEET, p_rows[MONTH_SHEET]);
    }
}

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

License:Apache License

/**
 * For Trados Style/*from ww w. j av  a2  s . co  m*/
 * 
 * @param p_projectMap
 * @param p_sheets
 * @param p_includeExReview
 * @param p_rows
 * @param p_data
 * @param bundle
 * @throws Exception
 */
private void writeProjectDataTradosStyle(HashMap<String, HashMap<String, ProjectWorkflowData>> p_projectMap,
        Workbook p_workbook, Sheet[] p_sheets, boolean p_includeExReview, IntHolder[] p_rows) throws Exception {
    ArrayList<String> keys = new ArrayList<String>(p_projectMap.keySet());
    SortUtil.sort(keys);
    Iterator<String> keysIter = keys.iterator();

    totalCost.clear();
    totalCostDate.clear();
    int finishedJobNum = 0;
    while (keysIter.hasNext()) {
        // Cancel generate reports.
        if (isCancelled())
            return;
        // Sets Reports Percent.
        setPercent(++finishedJobNum);

        String key = keysIter.next();
        String jobId = getJobIdFromMapKey(key);
        boolean isWrongJob = m_data.wrongJobNames.contains(jobId);
        HashMap<String, ProjectWorkflowData> localeMap = p_projectMap.get(key);
        ArrayList<String> locales = new ArrayList<String>(localeMap.keySet());
        SortUtil.sort(locales);
        Iterator<String> localeIter = locales.iterator();
        BigDecimal projectTotalWordCountCost = new BigDecimal(BIG_DECIMAL_ZERO_STRING);
        BigDecimal reviewTotalWordCountCost = new BigDecimal(BIG_DECIMAL_ZERO_STRING);

        // Counts the review costing total and the translation costing
        // total.
        String localeName = null;
        ProjectWorkflowData data = null;

        // Marks whether needs to add a blank line.
        boolean containsDellReview = false;

        while (localeIter.hasNext()) {
            int col = 0;
            localeName = (String) localeIter.next();
            data = (ProjectWorkflowData) localeMap.get(localeName);

            int row = p_rows[MONTH_SHEET].getValue();
            Row theRow = getRow(p_sheets[MONTH_SHEET], row);

            CellStyle temp_moneyStyle = getMoneyStyle(p_workbook);
            CellStyle temp_normalStyle = getContentStyle(p_workbook);

            if (data.wasExportFailed) {
                temp_moneyStyle = getFailedMoneyStyle(p_workbook);
                temp_normalStyle = getRedCellStyle(p_workbook);
            }

            // Company Name
            Cell cell_A = getCell(theRow, col++);
            cell_A.setCellValue(data.companyName);
            cell_A.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);

            // Project Description
            Cell cell_B = getCell(theRow, col++);
            cell_B.setCellValue(data.projectDesc);
            cell_B.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 22 * 256);

            if (isWrongJob) {
                // For "Add Job Id into online job report" issue
                if (isJobIdVisible) {
                    Cell cell_C = getCell(theRow, col++);
                    cell_C.setCellValue(Long.valueOf(jobId));
                    cell_C.setCellStyle(getWrongJobStyle(p_workbook));
                }

                Cell cell_CorD = getCell(theRow, col++);
                cell_CorD.setCellValue(data.jobName);
                cell_CorD.setCellStyle(getWrongJobStyle(p_workbook));
            } else {
                // For "Add Job Id into online job report" issue
                if (isJobIdVisible) {
                    Cell cell_C = getCell(theRow, col++);
                    cell_C.setCellValue(Long.valueOf(jobId));
                    cell_C.setCellStyle(temp_normalStyle);
                }
                Cell cell_CorD = getCell(theRow, col++);
                cell_CorD.setCellValue(data.jobName);
                cell_CorD.setCellStyle(temp_normalStyle);
            }
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 50 * 256);

            Cell cell_DorE = getCell(theRow, col++);
            cell_DorE.setCellValue(getAllSouceFileFormats(data.allFileProfiles));
            cell_DorE.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            Cell cell_EorF = getCell(theRow, col++);
            cell_EorF.setCellValue(data.l10nProfileName);
            cell_EorF.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            Cell cell_MTPro = getCell(theRow, col++);
            cell_MTPro.setCellValue(data.mtProfile);
            cell_MTPro.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            Cell cell_ForG = getCell(theRow, col++);
            cell_ForG.setCellValue(data.fileProfileNames);
            cell_ForG.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 20 * 256);

            if (data.wasExportFailed) {
                Cell cell_GorH = getCell(theRow, col++);
                cell_GorH.setCellValue(data.creationDate);
                cell_GorH.setCellStyle(getFailedDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);

                Cell cell_HorI = getCell(theRow, col++);
                cell_HorI.setCellValue(data.creationDate);
                cell_HorI.setCellStyle(getFailedTimeStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);

                Cell cell_IorJ = getCell(theRow, col++);
                cell_IorJ.setCellValue("");
                cell_IorJ.setCellStyle(getFailedDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);

                Cell cell_JorK = getCell(theRow, col++);
                cell_JorK.setCellValue("");
                cell_JorK.setCellStyle(getFailedTimeStyle(p_workbook));
            } else {
                Cell cell_GorH = getCell(theRow, col++);
                cell_GorH.setCellValue(getDateFormat().format(data.creationDate));
                cell_GorH.setCellStyle(getDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);

                Cell cell_HorI = getCell(theRow, col++);
                cell_HorI.setCellValue(getTimeFormat().format(data.creationDate));
                cell_HorI.setCellStyle(getContentStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);

                Cell cell_IorJ = getCell(theRow, col++);
                if (data.wasExported) {
                    cell_IorJ.setCellValue(getDateFormat().format(data.exportDate));
                } else {
                    cell_IorJ.setCellValue("");
                }
                cell_IorJ.setCellStyle(getDateStyle(p_workbook));
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 15 * 256);

                String labelExportTime = "";
                if (data.wasExported) {
                    labelExportTime = getExportDateStr(getTimeFormat(), data.exportDate);
                }
                Cell cell_JorK = getCell(theRow, col++);
                cell_JorK.setCellValue(labelExportTime);
                cell_JorK.setCellStyle(getContentStyle(p_workbook));

            }
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);

            // Status
            Cell cell_KorL = getCell(theRow, col++);
            cell_KorL.setCellValue(data.status);
            cell_KorL.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 18 * 256);
            // Language
            Cell cell_LorM = getCell(theRow, col++);
            cell_LorM.setCellValue(data.targetLang);
            cell_LorM.setCellStyle(temp_normalStyle);

            int numwidth = 10;

            // Summary Start Column
            m_data.initSumStartCol(col);

            Cell cell_MorN = getCell(theRow, col++);
            cell_MorN.setCellValue(data.segmentTmWordCount);
            cell_MorN.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_NorO = getCell(theRow, col++);
            cell_NorO.setCellValue(data.hiFuzzyMatchWordCount);
            cell_NorO.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_OorP = getCell(theRow, col++);
            cell_OorP.setCellValue(data.medHiFuzzyMatchWordCount);
            cell_OorP.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_PorQ = getCell(theRow, col++);
            cell_PorQ.setCellValue(data.medFuzzyMatchWordCount);
            cell_PorQ.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_QorR = getCell(theRow, col++);
            cell_QorR.setCellValue(data.noMatchWordCount);
            cell_QorR.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_RorS = getCell(theRow, col++);
            cell_RorS.setCellValue(data.repetitionWordCount);
            cell_RorS.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            if (m_data.useInContext) {
                Cell cell_InContext = getCell(theRow, col++);
                cell_InContext.setCellValue(data.inContextMatchWordCount);
                cell_InContext.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);
            }

            Cell cell_MT = getCell(theRow, col++);
            cell_MT.setCellValue(data.mtTotalWordCount);
            cell_MT.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_Total = getCell(theRow, col++);
            cell_Total.setCellValue(data.totalWordCount);
            cell_Total.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, numwidth * 256);

            Cell cell_Score = getCell(theRow, col++);
            cell_Score.setCellValue(data.mtConfidenceScore);
            cell_Score.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 13 * 256);

            Cell cell_Count = getCell(theRow, col++);
            cell_Count.setCellValue(data.tmEngineWordCounts);
            cell_Count.setCellStyle(temp_normalStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, 13 * 256);

            int moneywidth = 12;

            Cell cell_SegmentCost = getCell(theRow, col++);
            cell_SegmentCost.setCellValue(asDouble(data.segmentTmWordCountCost));
            cell_SegmentCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_HiFuzzyMatchCost = getCell(theRow, col++);
            cell_HiFuzzyMatchCost.setCellValue(asDouble(data.hiFuzzyMatchWordCountCost));
            cell_HiFuzzyMatchCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_MedHiFuzzyMatchCost = getCell(theRow, col++);
            cell_MedHiFuzzyMatchCost.setCellValue(asDouble(data.medHiFuzzyMatchWordCountCost));
            cell_MedHiFuzzyMatchCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_MedFuzzyMatchCost = getCell(theRow, col++);
            cell_MedFuzzyMatchCost.setCellValue(asDouble(data.medFuzzyMatchWordCountCost));
            cell_MedFuzzyMatchCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_NoMatchCost = getCell(theRow, col++);
            cell_NoMatchCost.setCellValue(asDouble(data.noMatchWordCountCost));
            cell_NoMatchCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            Cell cell_RepetitionCost = getCell(theRow, col++);
            cell_RepetitionCost.setCellValue(asDouble(data.repetitionWordCountCost));
            cell_RepetitionCost.setCellStyle(temp_moneyStyle);
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

            if (m_data.useInContext) {
                Cell cell_InContextCost = getCell(theRow, col++);
                cell_InContextCost.setCellValue(asDouble(data.inContextMatchWordCountCost));
                cell_InContextCost.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);
            }

            if (totalCol == null) {
                totalCol = ReportUtil.toChar(col);
            }
            Cell cell_TotalCost = getCell(theRow, col++);
            cell_TotalCost.setCellValue(asDouble(data.totalWordCountCost));
            cell_TotalCost.setCellStyle(temp_moneyStyle);

            // Show total additional charges
            // p_sheets[MONTH_SHEET].setColumnView(col - 1, moneywidth);
            // p_sheets[MONTH_SHEET].addCell(new Number(col++, row,
            // asDouble(data.totalAdditionalCost), temp_moneyFormat));

            // p_sheets[MONTH_SHEET].setColumnView(col - 1, moneywidth);
            projectTotalWordCountCost = projectTotalWordCountCost.add(data.totalWordCountCost);

            List<Integer> indexs = totalCost.get(data.targetLang);
            if (indexs == null) {
                indexs = new ArrayList<Integer>();
                totalCost.put(data.targetLang, indexs);
            }
            indexs.add(row + 1);

            Double value = totalCostDate.get(data.targetLang);
            if (value == null) {
                value = 0.0;
            }
            value += asDouble(data.totalWordCountCost);
            totalCostDate.put(data.targetLang, value);

            // add a "project total" summary cost over the locales
            // map(1,moneyFormat)
            if (localeIter.hasNext() == false) {
                Cell cell_TotalAdditionalCost = getCell(theRow, col++);
                cell_TotalAdditionalCost.setCellValue(asDouble(data.totalAdditionalCost));
                cell_TotalAdditionalCost.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                Cell cell_ProjectTotalCost = getCell(theRow, col++);
                cell_ProjectTotalCost
                        .setCellValue(asDouble(projectTotalWordCountCost) + asDouble(data.totalAdditionalCost));
                cell_ProjectTotalCost.setCellStyle(temp_moneyStyle);
            } else {
                Cell cell_TotalAdditionalCost = getCell(theRow, col++);
                cell_TotalAdditionalCost.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                Cell cell_ProjectTotalCost = getCell(theRow, col++);
                cell_ProjectTotalCost.setCellStyle(temp_moneyStyle);
            }
            p_sheets[MONTH_SHEET].setColumnWidth(col - 1, moneywidth * 256);
            p_rows[MONTH_SHEET].inc();

            // Write data into MONTH_REVIEW_SHEET
            if (p_includeExReview && data.containsDellReview) {
                containsDellReview = true;

                row = p_rows[MONTH_REVIEW_SHEET].getValue();
                col = 0;

                // Company Name
                Cell cell_A_Review = getCell(theRow, col++);
                cell_A_Review.setCellValue(data.companyName);
                cell_A_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);

                // Project Description
                Cell cell_B_Review = getCell(theRow, col++);
                cell_B_Review.setCellValue(data.projectDesc);
                cell_B_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 22 * 256);

                if (isWrongJob) {
                    // For "Job id not showing in external review tabs"
                    // Issue
                    if (isJobIdVisible) {
                        Cell cell_C_Review = getCell(theRow, col++);
                        cell_C_Review.setCellValue(data.jobId);
                        cell_C_Review.setCellStyle(getWrongJobStyle(p_workbook));
                    }
                    Cell cell_CorD_Review = getCell(theRow, col++);
                    cell_CorD_Review.setCellValue(data.jobName);
                    cell_CorD_Review.setCellStyle(getWrongJobStyle(p_workbook));
                } else {
                    // For "Job id not showing in external review tabs"
                    // Issue
                    if (isJobIdVisible) {
                        Cell cell_C_Review = getCell(theRow, col++);
                        cell_C_Review.setCellValue(data.jobId);
                        cell_C_Review.setCellStyle(temp_normalStyle);
                    }
                    Cell cell_CorD_Review = getCell(theRow, col++);
                    cell_CorD_Review.setCellValue(data.jobName);
                    cell_CorD_Review.setCellStyle(temp_normalStyle);
                }
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 50 * 256);
                Cell cell_DorE_Review = getCell(theRow, col++);
                cell_DorE_Review.setCellValue(data.projectDesc);
                cell_DorE_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 22 * 256);

                if (data.wasExportFailed) {
                    /*
                     * p_sheets[MONTH_SHEET].addCell(new DateTime(col++,
                     * row, data.creationDate, failed_dateFormat));
                     */
                    Cell cell_EorF_Review = getCell(theRow, col++);
                    cell_EorF_Review.setCellValue(data.creationDate);
                    cell_EorF_Review.setCellStyle(getFailedDateStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);

                    Cell cell_ForG_Review = getCell(theRow, col++);
                    cell_ForG_Review.setCellValue(data.creationDate);
                    cell_ForG_Review.setCellStyle(getFailedTimeStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 18 * 256);

                    Cell cell_GorH_Review = getCell(theRow, col++);
                    cell_GorH_Review.setCellValue("");
                    cell_GorH_Review.setCellStyle(getFailedDateStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);

                    Cell cell_HorI_Review = getCell(theRow, col++);
                    cell_HorI_Review.setCellValue("");
                    cell_HorI_Review.setCellStyle(getFailedTimeStyle(p_workbook));
                } else {
                    /*
                     * p_sheets[MONTH_SHEET].addCell(new Label(col++, row,
                     * dateFormat.format(data.creationDate)));
                     */
                    Cell cell_EorF_Review = getCell(theRow, col++);
                    cell_EorF_Review.setCellValue(getDateFormat().format(data.creationDate));
                    cell_EorF_Review.setCellStyle(getContentStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);

                    Cell cell_ForG_Review = getCell(theRow, col++);
                    cell_ForG_Review.setCellValue(getTimeFormat().format(data.creationDate));
                    cell_ForG_Review.setCellStyle(getContentStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 18 * 256);

                    String labelExportDate = "";
                    if (data.wasExported) {
                        labelExportDate = getExportDateStr(getDateFormat(), data.exportDate);
                    }
                    Cell cell_GorH_Review = getCell(theRow, col++);
                    cell_GorH_Review.setCellValue(labelExportDate);
                    cell_GorH_Review.setCellStyle(getContentStyle(p_workbook));
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 15 * 256);

                    String labelExportTime = "";
                    if (data.wasExported) {
                        labelExportTime = getExportDateStr(getTimeFormat(), data.exportDate);
                    }
                    Cell cell_HorI_Review = getCell(theRow, col++);
                    cell_HorI_Review.setCellValue(labelExportTime);
                    cell_HorI_Review.setCellStyle(getContentStyle(p_workbook));

                }
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 18 * 256);
                Cell cell_IorJ_Review = getCell(theRow, col++);
                cell_IorJ_Review.setCellValue(data.targetLang);
                cell_IorJ_Review.setCellStyle(temp_normalStyle);

                Cell cell_JorK_Review = getCell(theRow, col++);
                cell_JorK_Review.setCellValue(data.repetitionWordCount);
                cell_JorK_Review.setCellStyle(temp_normalStyle);

                numwidth = 10;
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);
                Cell cell_KorL_Review = getCell(theRow, col++);
                cell_KorL_Review.setCellValue(data.segmentTmWordCount);
                cell_KorL_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                if (m_data.useInContext) {
                    Cell cell_InContext = getCell(theRow, col++);
                    cell_InContext.setCellValue(data.inContextMatchWordCount);
                    cell_InContext.setCellStyle(temp_normalStyle);
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);
                }

                Cell cell_FuzzyMatch_Review = getCell(theRow, col++);
                cell_FuzzyMatch_Review.setCellValue(data.fuzzyMatchWordCount);
                cell_FuzzyMatch_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                Cell cell_NoMatch_Review = getCell(theRow, col++);
                cell_NoMatch_Review.setCellValue(data.noMatchWordCount);
                cell_NoMatch_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                //                    Cell cell_MT_Review = getCell(theRow, col++);
                //                    cell_MT_Review.setCellValue(data.mtFuzzyNoMatchWordCount);
                //                    cell_MT_Review.setCellStyle(temp_normalStyle);
                //                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1,
                //                            numwidth * 256);

                Cell cell_Total_Review = getCell(theRow, col++);
                cell_Total_Review.setCellValue(data.totalWordCount);
                cell_Total_Review.setCellStyle(temp_normalStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, numwidth * 256);

                //                    Cell cell_Score_Review = getCell(theRow, col++);
                //                    cell_Score_Review.setCellValue(data.mtConfidenceScore);
                //                    cell_Score_Review.setCellStyle(getContentStyle(p_workbook));
                //                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 13 * 256);
                //                    
                //                    Cell cell_Count_Review = getCell(theRow, col++);
                //                    cell_Count_Review.setCellValue(data.tmEngineWordCounts);
                //                    cell_Count_Review.setCellStyle(getContentStyle(p_workbook));
                //                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, 13 * 256);

                moneywidth = 12;
                Cell cell_RepetitionCost_Review = getCell(theRow, col++);
                cell_RepetitionCost_Review.setCellValue(asDouble(data.repetitionWordCountCostForDellReview));
                cell_RepetitionCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                Cell cell_SegmentCost_Review = getCell(theRow, col++);
                cell_SegmentCost_Review.setCellValue(asDouble(data.segmentTmWordCountCostForDellReview));
                cell_SegmentCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                if (m_data.useInContext) {
                    Cell cell_InContext = getCell(theRow, col++);
                    cell_InContext.setCellValue(asDouble(data.inContextMatchWordCountCostForDellReview));
                    cell_InContext.setCellStyle(temp_moneyStyle);
                    p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                }

                Cell cell_FuzzyMatchCost_Review = getCell(theRow, col++);
                cell_FuzzyMatchCost_Review.setCellValue(asDouble(data.fuzzyMatchWordCountCostForDellReview));
                cell_FuzzyMatchCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                Cell cell_NoMatchCost_Review = getCell(theRow, col++);
                cell_NoMatchCost_Review.setCellValue(asDouble(data.noMatchWordCountCostForDellReview));
                cell_NoMatchCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                reviewTotalWordCountCost = reviewTotalWordCountCost.add(data.totalWordCountCostForDellReview);

                // Writes the "Translation Total" column.
                Cell cell_TotalCost_Review = getCell(theRow, col++);
                cell_TotalCost_Review.setCellValue(asDouble(data.totalWordCountCost));
                cell_TotalCost_Review.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                // Writes the "Review" column.
                Cell cell_Rview = getCell(theRow, col++);
                cell_Rview.setCellValue(asDouble(data.totalWordCountCostForDellReview));
                cell_Rview.setCellStyle(temp_moneyStyle);
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);

                // add "job total" cost over the locales
                if (localeIter.hasNext() == false) {
                    Cell cell_JobTotal = getCell(theRow, col++);
                    cell_JobTotal
                            .setCellValue(asDouble(projectTotalWordCountCost.add(reviewTotalWordCountCost)));
                    cell_JobTotal.setCellStyle(temp_moneyStyle);
                } else {
                    Cell cell_JobTotal = getCell(theRow, col++);
                    cell_JobTotal.setCellStyle(temp_moneyStyle);
                }
                p_sheets[MONTH_REVIEW_SHEET].setColumnWidth(col - 1, moneywidth * 256);
                p_rows[MONTH_REVIEW_SHEET].inc();
            } // End if (p_includeExReview && data.containsDellReview)
        } // End loop while (localeIter.hasNext())

        p_rows[MONTH_SHEET].inc();
        if (p_includeExReview && containsDellReview) {
            p_rows[MONTH_REVIEW_SHEET].inc();
        }

    } // End loop while (projectIter.hasNext())

    p_rows[MONTH_SHEET].inc();
    addTotals(p_workbook, p_sheets[MONTH_SHEET], MONTH_SHEET, p_rows[MONTH_SHEET]);

    if (p_includeExReview) {
        p_rows[MONTH_REVIEW_SHEET].inc();
        addTotals(p_workbook, p_sheets[MONTH_REVIEW_SHEET], MONTH_REVIEW_SHEET, p_rows[MONTH_REVIEW_SHEET]);
    }

    if (totalCol != null) {
        addTotalsPerLang(p_workbook, p_sheets[MONTH_SHEET], MONTH_SHEET, p_rows[MONTH_SHEET]);
    }
}