List of usage examples for org.apache.poi.ss.usermodel Cell setCellStyle
void setCellStyle(CellStyle style);
Set the style for the cell.
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./*from w ww . j av a 2s. c o m*/ * * @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.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. ja va2 s .com 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);//w w w . j av a2 s. c om 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 .ja va2 s . c o m * * @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);//from www. ja v a2 s. c om 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 w w w .j a v a 2 s . c o 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]); } }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private void addTotalsPerLang(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory, IntHolder p_row) throws Exception { Font subTotalFont = p_workbook.createFont(); subTotalFont.setBoldweight(Font.BOLDWEIGHT_BOLD); subTotalFont.setColor(IndexedColors.BLACK.getIndex()); subTotalFont.setUnderline(Font.U_NONE); subTotalFont.setFontName("Arial"); subTotalFont.setFontHeightInPoints((short) 10); CellStyle subTotalStyle = p_workbook.createCellStyle(); subTotalStyle.setFont(subTotalFont); String title = m_bundle.getString("lb_total_cost_per_lang"); int row = p_row.getValue() + 4; // skip a row ArrayList<String> locales = new ArrayList<String>(totalCost.keySet()); SortUtil.sort(locales);//from ww w. j a va 2s . c o m int col = m_data.getSumStartCol(); Row theRow = getRow(p_sheet, row); Cell cell_Title = getCell(theRow, col - 3); cell_Title.setCellValue(title); cell_Title.setCellStyle(subTotalStyle); File imgFile = File.createTempFile("GSJobChart", ".png"); JfreeCharUtil.drawPieChart2D("", totalCostDate, imgFile); Drawing patriarch = p_sheet.createDrawingPatriarch(); XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 15, row - 1, 22, row + 24); ByteArrayOutputStream img_bytes = new ByteArrayOutputStream(); InputStream is = imgFile.toURI().toURL().openStream(); int b; while ((b = is.read()) != -1) { img_bytes.write(b); } is.close(); int i = p_workbook.addPicture(img_bytes.toByteArray(), SXSSFWorkbook.PICTURE_TYPE_PNG); patriarch.createPicture(anchor, i); for (String locale : locales) { List<Integer> indexs = totalCost.get(locale); StringBuffer values = new StringBuffer(); for (Integer index : indexs) { if (values.length() == 0) { values.append("SUM("); } else { values.append("+"); } values.append(totalCol).append(index); } values.append(")"); Row perRow = getRow(p_sheet, row); Cell cell_Locale = getCell(perRow, col - 1); cell_Locale.setCellValue(locale); cell_Locale.setCellStyle(getContentStyle(p_workbook)); Cell cell_Total = getCell(perRow, col); cell_Total.setCellFormula(values.toString()); cell_Total.setCellStyle(getMoneyStyle(p_workbook)); row++; } // Reset total column number for every sheet. totalCol = null; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
/** * Add totals row/* ww w . j av a 2 s .c o m*/ * * @param p_sheet * @param p_sheetCategory * @param p_row * @param p_data * @param bundle * @throws Exception */ private void addTotals(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory, IntHolder p_row) throws Exception { int row = p_row.getValue() + 1; // skip a row String title = m_bundle.getString("lb_totals"); java.text.NumberFormat.getCurrencyInstance(Locale.US); // Get Summary Start Column int c = m_data.getSumStartCol(); String sumStartCol = getColumnName(c); Row theRow = getRow(p_sheet, row); Cell cell_A = getCell(theRow, 0); cell_A.setCellValue(title); cell_A.setCellStyle(getSubTotalStyle(p_workbook)); // modify the number 3 to "sumStartCellCol-B" for "Add Job Id into // online job report" issue p_sheet.addMergedRegion(new CellRangeAddress(row, row, 0, sumStartCol.charAt(0) - 'B')); setRegionStyle(p_sheet, new CellRangeAddress(row, row, 0, sumStartCol.charAt(0) - 'B'), getSubTotalStyle(p_workbook)); int lastRow = p_row.getValue() - 2; // add in word count totals // word counts Cell cell_B = getCell(theRow, c++); cell_B.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_B.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_C = getCell(theRow, c++); cell_C.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_C.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_D = getCell(theRow, c++); cell_D.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_D.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_E = getCell(theRow, c++); cell_E.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_E.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_F = getCell(theRow, c++); cell_F.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_F.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); if (m_data.isTradosStyle()) { Cell cell_G = getCell(theRow, c++); cell_G.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_G.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_H = getCell(theRow, c++); cell_H.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_H.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); } Cell cell_MT = getCell(theRow, c++); cell_MT.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_MT.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); if (m_data.useInContext) { Cell cell_InContext = getCell(theRow, c++); cell_InContext.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_InContext.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); } Cell cell_Score = getCell(theRow, c++); cell_Score.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_Score.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_MTEWC = getCell(theRow, c++); cell_MTEWC.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_MTEWC.setCellStyle(getSubTotalStyle(p_workbook)); sumStartCol = getColumnName(c); // word count costs Cell cell_K = getCell(theRow, c++); cell_K.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_K.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_L = getCell(theRow, c++); cell_L.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_L.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_M = getCell(theRow, c++); cell_M.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_M.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_N = getCell(theRow, c++); cell_N.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_N.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_O = getCell(theRow, c++); cell_O.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_O.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_P = getCell(theRow, c++); cell_P.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_P.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_Q = getCell(theRow, c++); cell_Q.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_Q.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); if (m_data.isTradosStyle()) { Cell cell_R = getCell(theRow, c++); cell_R.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_R.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); Cell cell_S = getCell(theRow, c++); cell_S.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_S.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); } if (m_data.useInContext) { Cell cell_InContext = getCell(theRow, c++); cell_InContext.setCellFormula("SUM(" + sumStartCol + "5:" + sumStartCol + lastRow + ")"); cell_InContext.setCellStyle(getTotalMoneyStyle(p_workbook)); sumStartCol = getColumnName(c); } // add an extra column for Dell Tracking Use Cell cell_V = getCell(theRow, c++); cell_V.setCellValue(""); cell_V.setCellStyle(getTotalMoneyStyle(p_workbook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private void addParamsSheet(Workbook p_workbook, String year, boolean recalculateFinishedWorkflow) throws Exception { Sheet paramsSheet = p_workbook.createSheet(m_bundle.getString("lb_criteria")); Row firRow = getRow(paramsSheet, 0); Cell cell_A_Header = getCell(firRow, 0); cell_A_Header.setCellValue(m_bundle.getString("lb_report_criteria")); cell_A_Header.setCellStyle(getContentStyle(p_workbook)); paramsSheet.setColumnWidth(0, 50 * 256); Row secRow = getRow(paramsSheet, 1); Cell cell_A_Project = getCell(secRow, 0); if (m_data.wantsAllProjects) { cell_A_Project/*from w w w .ja v a 2s . c om*/ .setCellValue(m_bundle.getString("lb_selected_projects") + " " + m_bundle.getString("all")); cell_A_Project.setCellStyle(getContentStyle(p_workbook)); } else { cell_A_Project.setCellValue(m_bundle.getString("lb_selected_projects")); cell_A_Project.setCellStyle(getContentStyle(p_workbook)); Iterator<Long> iter = m_data.projectIdList.iterator(); int r = 3; while (iter.hasNext()) { Long pid = (Long) iter.next(); String projectName = "??"; try { Project p = ServerProxy.getProjectHandler().getProjectById(pid.longValue()); projectName = p.getName(); } catch (Exception e) { } Row row = getRow(paramsSheet, r); Cell cell_A = getCell(row, 0); cell_A.setCellValue(projectName); cell_A.setCellStyle(getContentStyle(p_workbook)); Cell cell_B = getCell(row, 1); cell_B.setCellValue(m_bundle.getString("lb_id") + "=" + pid.toString()); cell_B.setCellStyle(getContentStyle(p_workbook)); r++; } } Cell cell_C_Header = getCell(firRow, 2); cell_C_Header.setCellValue(m_bundle.getString("lb_Year")); cell_C_Header.setCellStyle(getContentStyle(p_workbook)); Cell cell_C = getCell(secRow, 2); cell_C.setCellValue(year); cell_C.setCellStyle(getContentStyle(p_workbook)); Cell cell_D_Header = getCell(firRow, 3); cell_D_Header.setCellValue(m_bundle.getString("lb_re_cost_jobs")); cell_D_Header.setCellStyle(getContentStyle(p_workbook)); Cell cell_D = getCell(secRow, 3); cell_D.setCellValue(java.lang.Boolean.toString(recalculateFinishedWorkflow)); cell_D.setCellStyle(getContentStyle(p_workbook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
public void setRegionStyle(Sheet sheet, CellRangeAddress cellRangeAddress, CellStyle cs) { for (int i = cellRangeAddress.getFirstRow(); i <= cellRangeAddress.getLastRow(); i++) { Row row = getRow(sheet, i);/* www . j a v a 2 s .com*/ for (int j = cellRangeAddress.getFirstColumn(); j <= cellRangeAddress.getLastColumn(); j++) { Cell cell = getCell(row, j); cell.setCellStyle(cs); } } }