List of usage examples for org.apache.poi.ss.usermodel Sheet setColumnWidth
void setColumnWidth(int columnIndex, int width);
The maximum column width for an individual cell is 255 characters.
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java
License:Apache License
private void writeParamsSheet(Workbook p_workbook, Sheet paramsSheet) throws Exception { Row firRow = getRow(paramsSheet, 0); Row secRow = getRow(paramsSheet, 1); Row thirRow = getRow(paramsSheet, 2); Cell cell_A_Title = getCell(firRow, 0); cell_A_Title.setCellValue(bundle.getString("lb_report_criteria")); cell_A_Title.setCellStyle(getContentStyle(p_workbook)); paramsSheet.setColumnWidth(0, 50 * 256); Cell cell_A_Header = getCell(secRow, 0); if (data.wantsAllProjects) { cell_A_Header.setCellValue(bundle.getString("lb_selected_projects") + " " + bundle.getString("all")); cell_A_Header.setCellStyle(getContentStyle(p_workbook)); } else {/*from w ww .ja v a 2 s.c om*/ cell_A_Header.setCellValue(bundle.getString("lb_selected_projects")); cell_A_Header.setCellStyle(getContentStyle(p_workbook)); Iterator iter = data.projectIdList.iterator(); int r = 2; while (iter.hasNext()) { Long pid = (Long) iter.next(); String projectName = "??"; try { Project p = ServerProxy.getProjectHandler().getProjectById(pid.longValue()); projectName = p.getName(); } catch (Exception e) { s_logger.error("Failed to get project." + e); } Row theRow = getRow(paramsSheet, r); String v = projectName + " (" + bundle.getString("lb_report_id") + "=" + pid.toString() + ")"; Cell cell_A = getCell(theRow, 0); cell_A.setCellValue(v); cell_A.setCellStyle(getContentStyle(p_workbook)); r++; } } // add the date criteria String fromMsg = request.getParameter(JobSearchConstants.CREATION_START); String untilMsg = request.getParameter(JobSearchConstants.CREATION_END); Cell cell_B_Header = getCell(secRow, 1); cell_B_Header.setCellValue(bundle.getString("lb_from") + ":"); cell_B_Header.setCellStyle(getContentStyle(p_workbook)); Cell cell_B = getCell(thirRow, 1); cell_B.setCellValue(fromMsg); cell_B.setCellStyle(getContentStyle(p_workbook)); paramsSheet.setColumnWidth(1, 20 * 256); Cell cell_C_Header = getCell(secRow, 2); cell_C_Header.setCellValue(bundle.getString("lb_until") + ":"); cell_C_Header.setCellStyle(getContentStyle(p_workbook)); Cell cell_C = getCell(thirRow, 2); cell_C.setCellValue(untilMsg); cell_C.setCellStyle(getContentStyle(p_workbook)); paramsSheet.setColumnWidth(2, 20 * 256); // add the target lang criteria paramsSheet.setColumnWidth(3, 20 * 256); Cell cell_D_Header = getCell(secRow, 3); if (data.wantsAllTargetLangs) { cell_D_Header.setCellValue(bundle.getString("lb_selected_langs") + " " + bundle.getString("all")); cell_D_Header.setCellStyle(getContentStyle(p_workbook)); } else { cell_D_Header.setCellValue(bundle.getString("lb_selected_langs")); cell_D_Header.setCellStyle(getContentStyle(p_workbook)); Iterator iter = data.targetLangList.iterator(); int r = 2; LocaleManagerLocal manager = new LocaleManagerLocal(); while (iter.hasNext()) { String lang = (String) iter.next(); Row theRow = getRow(paramsSheet, r++); Cell cell_D = getCell(theRow, 3); cell_D.setCellValue(manager.getLocaleById(Long.valueOf(lang)).toString()); cell_D.setCellStyle(getContentStyle(p_workbook)); } } paramsSheet.setColumnWidth(4, 20 * 256); Cell cell_E_Header = getCell(secRow, 4); if (data.allJobStatus) { cell_E_Header.setCellValue(bundle.getString("lb_job_status") + ": " + bundle.getString("all")); cell_E_Header.setCellStyle(getContentStyle(p_workbook)); } else { cell_E_Header.setCellValue(bundle.getString("lb_job_status") + ": "); cell_E_Header.setCellStyle(getContentStyle(p_workbook)); Iterator iter = data.jobStatusList.iterator(); int r = 2; while (iter.hasNext()) { String jobStatus = (String) iter.next(); Row theRow = getRow(paramsSheet, r); Cell cell_E = getCell(theRow, 4); cell_E.setCellValue(jobStatus); cell_E.setCellStyle(getContentStyle(p_workbook)); r++; } } paramsSheet.setColumnWidth(5, 30 * 256); Cell cell_F_Header = getCell(secRow, 5); if (data.allActivities) { cell_F_Header.setCellValue(bundle.getString("lb_activity_name") + ": " + bundle.getString("all")); cell_F_Header.setCellStyle(getContentStyle(p_workbook)); } else { cell_F_Header.setCellValue(bundle.getString("lb_activity_name") + ": "); cell_F_Header.setCellStyle(getContentStyle(p_workbook)); Iterator iter = data.activityNameList.iterator(); int r = 2; while (iter.hasNext()) { String activityName = (String) iter.next(); Activity activity = (Activity) ServerProxy.getJobHandler().getActivity(activityName); Row theRow = getRow(paramsSheet, r); Cell cell_F = getCell(theRow, 5); cell_F.setCellValue(activity.getDisplayName()); cell_F.setCellStyle(getContentStyle(p_workbook)); r++; } } }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.SlaXlsReportHelper.java
License:Apache License
private void addTitle(Workbook p_workbook) throws Exception { Sheet theSheet = data.generalSheet; // title font is black bold on white Font titleFont = p_workbook.createFont(); titleFont.setUnderline(Font.U_NONE); titleFont.setFontName("Arial"); titleFont.setFontHeightInPoints((short) 14); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); titleFont.setColor(IndexedColors.BLACK.getIndex()); CellStyle titleStyle = p_workbook.createCellStyle(); titleStyle.setWrapText(false);/*from w w w . j a v a 2 s.c om*/ titleStyle.setFont(titleFont); Cell titleCell = getCell(getRow(theSheet, 0), 0); titleCell.setCellValue(bundle.getString("translation_sla_performance")); titleCell.setCellStyle(titleStyle); theSheet.setColumnWidth(0, 20 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.SlaXlsReportHelper.java
License:Apache License
/** * Adds the table header for the Dell Matches sheet * //from www . j a v a 2 s .c o m */ private void addHeader(Workbook p_workbook) throws Exception { Sheet theSheet = data.generalSheet; int c = 0; Row headerRow = getRow(theSheet, 2); Cell cell_A = getCell(headerRow, c); cell_A.setCellValue(bundle.getString("lb_job_id")); cell_A.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 7 * 256); c++; Cell cell_B = getCell(headerRow, c); cell_B.setCellValue(bundle.getString("lb_job_name")); cell_B.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 40 * 256); c++; Cell cell_C = getCell(headerRow, c); cell_C.setCellValue(bundle.getString("lb_workflow")); cell_C.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 25 * 256); c++; Cell cell_D = getCell(headerRow, c); cell_D.setCellValue(bundle.getString("lb_language")); cell_D.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 12 * 256); c++; Cell cell_E = getCell(headerRow, c); cell_E.setCellValue(bundle.getString("lb_word_count")); cell_E.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 7 * 256); c++; Cell cell_F = getCell(headerRow, c); cell_F.setCellValue(bundle.getString("lb_current_activity")); cell_F.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 14 * 256); c++; Cell cell_G = getCell(headerRow, c); cell_G.setCellValue(bundle.getString("lb_translation_start_date")); cell_G.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 28 * 256); c++; Cell cell_H = getCell(headerRow, c); cell_H.setCellValue(bundle.getString("lb_translation_due_date")); cell_H.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 28 * 256); c++; Cell cell_I = getCell(headerRow, c); cell_I.setCellValue(bundle.getString("lb_translation_finish_date")); cell_I.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 28 * 256); c++; Cell cell_J = getCell(headerRow, c); cell_J.setCellValue(bundle.getString("lb_on_time")); cell_J.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 28 * 256); c++; Cell cell_K = getCell(headerRow, c); cell_K.setCellValue(bundle.getString("lb_leadtime")); cell_K.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 12 * 256); c++; Cell cell_L = getCell(headerRow, c); cell_L.setCellValue(bundle.getString("lb_actual_performance")); cell_L.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 14 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.TranslationProgressReportHelper.java
License:Apache License
private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception { // title font is black bold on white // String EMEA = CompanyWrapper.getCurrentCompanyName(); Font titleFont = p_workbook.createFont(); titleFont.setUnderline(Font.U_NONE); titleFont.setFontName("Times"); titleFont.setFontHeightInPoints((short) 14); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); titleFont.setColor(IndexedColors.BLACK.getIndex()); CellStyle titleStyle = p_workbook.createCellStyle(); titleStyle.setWrapText(false);/*from w ww. j a va2 s . c o m*/ titleStyle.setFont(titleFont); Row titleRow = getRow(p_sheet, 0); Cell cell_A_Title = getCell(titleRow, 0); cell_A_Title.setCellValue(bundle.getString("review_translation_progress_report")); cell_A_Title.setCellStyle(titleStyle); p_sheet.setColumnWidth(0, 22 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.TranslationProgressReportHelper.java
License:Apache License
private void addLanguageHeader(Workbook p_workbook, Sheet p_sheet) throws Exception { int col = 0;//from w w w . j a v a 2s . c o m int row = 3; Row headerRow = getRow(p_sheet, row); Cell cell_SourceLang = getCell(headerRow, col++); cell_SourceLang.setCellValue(bundle.getString("lb_source_language")); cell_SourceLang.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 27 * 256); Cell cell_TargetLang = getCell(headerRow, col++); cell_TargetLang.setCellValue(bundle.getString("lb_target_language")); cell_TargetLang.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 27 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.TranslationProgressReportHelper.java
License:Apache License
/** * Adds the table header to the sheet/* ww w .j a v a 2s . c o m*/ * * @param p_sheet */ private void addSegmentHeader(Workbook p_workbook, Sheet p_sheet) throws Exception { int col = 0; int row = 6; Row secHeaderRow = getRow(p_sheet, row); Cell cell_A = getCell(secHeaderRow, col++); cell_A.setCellValue(bundle.getString("lb_project")); cell_A.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 27 * 256); Cell cell_B = getCell(secHeaderRow, col++); cell_B.setCellValue(bundle.getString("lb_job_id_report")); cell_B.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 27 * 256); Cell cell_C = getCell(secHeaderRow, col++); cell_C.setCellValue(bundle.getString("lb_job_name")); cell_C.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 30 * 256); Cell cell_D = getCell(secHeaderRow, col++); cell_D.setCellValue(bundle.getString("lb_document_name")); cell_D.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 40 * 256); Cell cell_E = getCell(secHeaderRow, col++); cell_E.setCellValue(bundle.getString("lb_total_translated_text")); cell_E.setCellStyle(getHeaderStyle(p_workbook)); p_sheet.setColumnWidth(col - 1, 20 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java
License:Apache License
private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception { // title font is black bold on white 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); titleFont.setColor(IndexedColors.BLACK.getIndex()); CellStyle titleStyle = p_workbook.createCellStyle(); titleStyle.setWrapText(false);/* w w w .j av a2s .c om*/ titleStyle.setFont(titleFont); Row titleRow = getRow(p_sheet, 0); Cell cell_A_Title = getCell(titleRow, 0); cell_A_Title.setCellValue(EMEA + " " + bundle.getString("lb_po")); cell_A_Title.setCellStyle(titleStyle); p_sheet.setColumnWidth(0, 20 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java
License:Apache License
/** * Adds the table header for the Dell Matches sheet * //from w w w. j av a 2 s . co m */ private void addHeaderForDellMatches(Workbook p_workbook, MyData p_data) throws Exception { Sheet theSheet = p_data.dellSheet; int c = 0; Row thirRow = getRow(theSheet, 2); Row fourRow = getRow(theSheet, 3); Cell cell_A = getCell(thirRow, c); cell_A.setCellValue(bundle.getString("lb_job_id")); cell_A.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_B = getCell(thirRow, c); cell_B.setCellValue(bundle.getString("lb_job")); cell_B.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_C = getCell(thirRow, c); cell_C.setCellValue(bundle.getString("lb_po_number_report")); cell_C.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 15 * 256); c++; Cell cell_D = getCell(thirRow, c); cell_D.setCellValue(bundle.getString("lb_description")); cell_D.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 15 * 256); c++; Cell cell_E = getCell(thirRow, c); cell_E.setCellValue(bundle.getString("lb_creation_date")); cell_E.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_F = getCell(thirRow, c); cell_F.setCellValue(bundle.getString("lb_lang")); cell_F.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_G_Header = getCell(thirRow, c); cell_G_Header.setCellValue(bundle.getString("lb_word_counts")); cell_G_Header.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 5)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 5), getHeaderStyle(p_workbook)); } else { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 4)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 4), getHeaderStyle(p_workbook)); } Cell cell_G = getCell(fourRow, c++); cell_G.setCellValue(bundle.getString("jobinfo.tmmatches.wordcounts.internalreps")); cell_G.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_H = getCell(fourRow, c++); cell_H.setCellValue(bundle.getString("jobinfo.tmmatches.wordcounts.exactmatches")); cell_H.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { Cell cell_InContext = getCell(fourRow, c++); cell_InContext.setCellValue(bundle.getString("jobinfo.tmmatches.wordcounts.incontextmatches")); cell_InContext.setCellStyle(getHeaderStyle(p_workbook)); } Cell cell_FuzzyMatches = getCell(fourRow, c++); cell_FuzzyMatches.setCellValue(bundle.getString("jobinfo.tmmatches.wordcounts.fuzzymatches")); cell_FuzzyMatches.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_Newwords = getCell(fourRow, c++); cell_Newwords.setCellValue(bundle.getString("jobinfo.tmmatches.wordcounts.newwords")); cell_Newwords.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_Total = getCell(fourRow, c++); cell_Total.setCellValue(bundle.getString("lb_total")); cell_Total.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_Invoice = getCell(thirRow, c); cell_Invoice.setCellValue(bundle.getString("jobinfo.tmmatches.invoice")); cell_Invoice.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 5)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 5), getHeaderStyle(p_workbook)); } else { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 4)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 4), getHeaderStyle(p_workbook)); } Cell cell_InternalReps = getCell(fourRow, c++); cell_InternalReps.setCellValue(bundle.getString("jobinfo.tmmatches.invoice.internalreps")); cell_InternalReps.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_ExactMatches = getCell(fourRow, c++); cell_ExactMatches.setCellValue(bundle.getString("jobinfo.tmmatches.invoice.exactmatches")); cell_ExactMatches.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { Cell cell_InContext = getCell(fourRow, c++); cell_InContext.setCellValue(bundle.getString("jobinfo.tmmatches.invoice.incontextmatches")); cell_InContext.setCellStyle(getHeaderStyle(p_workbook)); } Cell cell_FuzzyMatches_Invoice = getCell(fourRow, c++); cell_FuzzyMatches_Invoice.setCellValue(bundle.getString("jobinfo.tmmatches.invoice.fuzzymatches")); cell_FuzzyMatches_Invoice.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_NewWords_Invoice = getCell(fourRow, c++); cell_NewWords_Invoice.setCellValue(bundle.getString("jobinfo.tmmatches.invoice.newwords")); cell_NewWords_Invoice.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_Total_Invoice = getCell(fourRow, c++); cell_Total_Invoice.setCellValue(bundle.getString("lb_total")); cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getContentStyle(p_workbook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java
License:Apache License
/** * Adds the table header for the Trados Matches sheet * //from w ww. ja va2 s. c om */ private void addHeaderForTradosMatches(Workbook p_workbook, MyData p_data) throws Exception { Sheet theSheet = p_data.tradosSheet; int c = 0; Row secRow = getRow(theSheet, 1); Row thirRow = getRow(theSheet, 2); Row fourRow = getRow(theSheet, 3); Cell cell_Ldfl = getCell(secRow, c); cell_Ldfl.setCellValue(bundle.getString("lb_desp_file_list")); cell_Ldfl.setCellStyle(getContentStyle(p_workbook)); Cell cell_A = getCell(thirRow, c); cell_A.setCellValue(bundle.getString("lb_job_id")); cell_A.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_B = getCell(thirRow, c); cell_B.setCellValue(bundle.getString("lb_job")); cell_B.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_C = getCell(thirRow, c); cell_C.setCellValue(bundle.getString("lb_po_number_report")); cell_C.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_D = getCell(thirRow, c); cell_D.setCellValue(bundle.getString("reportDesc")); cell_D.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); theSheet.setColumnWidth(c, 15 * 256); c++; Cell cell_E = getCell(thirRow, c); cell_E.setCellValue(bundle.getString("lb_creation_date")); cell_E.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_F = getCell(thirRow, c); cell_F.setCellValue(bundle.getString("lb_lang")); cell_F.setCellStyle(getHeaderStyle(p_workbook)); theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c)); setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook)); c++; Cell cell_G_Header = getCell(thirRow, c); cell_G_Header.setCellValue(bundle.getString("jobinfo.tmmatches.wordcounts")); cell_G_Header.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 7)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 7), getHeaderStyle(p_workbook)); } else { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 6)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 6), getHeaderStyle(p_workbook)); } Cell cell_G = getCell(fourRow, c++); cell_G.setCellValue(bundle.getString("jobinfo.tradosmatches.invoice.per100matches")); cell_G.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_H = getCell(fourRow, c++); cell_H.setCellValue(bundle.getString("lb_95_99")); cell_H.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_I = getCell(fourRow, c++); cell_I.setCellValue(bundle.getString("lb_85_94")); cell_I.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_J = getCell(fourRow, c++); cell_J.setCellValue(bundle.getString("lb_75_84") + "*"); cell_J.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_K = getCell(fourRow, c++); cell_K.setCellValue(bundle.getString("lb_no_match")); cell_K.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_L = getCell(fourRow, c++); cell_L.setCellValue(bundle.getString("lb_repetition_word_cnt")); cell_L.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { Cell cell_InContext = getCell(fourRow, c++); cell_InContext.setCellValue(bundle.getString("lb_in_context_tm")); cell_InContext.setCellStyle(getHeaderStyle(p_workbook)); } Cell cell_Total = getCell(fourRow, c++); cell_Total.setCellValue(bundle.getString("lb_total")); cell_Total.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_Invoice = getCell(thirRow, c); cell_Invoice.setCellValue(bundle.getString("jobinfo.tmmatches.invoice")); cell_Invoice.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 7)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 7), getHeaderStyle(p_workbook)); } else { theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 6)); setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 6), getHeaderStyle(p_workbook)); } Cell cell_Per100Matches = getCell(fourRow, c++); cell_Per100Matches.setCellValue(bundle.getString("jobinfo.tradosmatches.invoice.per100matches")); cell_Per100Matches.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_95_99 = getCell(fourRow, c++); cell_95_99.setCellValue(bundle.getString("lb_95_99")); cell_95_99.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_85_94 = getCell(fourRow, c++); cell_85_94.setCellValue(bundle.getString("lb_85_94")); cell_85_94.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_75_84 = getCell(fourRow, c++); cell_75_84.setCellValue(bundle.getString("lb_75_84") + "*"); cell_75_84.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_NoMatch = getCell(fourRow, c++); cell_NoMatch.setCellValue(bundle.getString("lb_no_match")); cell_NoMatch.setCellStyle(getHeaderStyle(p_workbook)); Cell cell_Repetition = getCell(fourRow, c++); cell_Repetition.setCellValue(bundle.getString("lb_repetition_word_cnt")); cell_Repetition.setCellStyle(getHeaderStyle(p_workbook)); if (p_data.headers[0] != null) { Cell cell_InContext = getCell(fourRow, c++); cell_InContext.setCellValue(bundle.getString("lb_in_context_match")); cell_InContext.setCellStyle(getHeaderStyle(p_workbook)); } Cell cell_Total_Invoice = getCell(fourRow, c++); cell_Total_Invoice.setCellValue(bundle.getString("lb_total")); cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java
License:Apache License
public void writeProjectDataForDellMatches(Workbook p_workbook, HashMap p_projectMap, IntHolder p_row, MyData p_data) throws Exception { Sheet theSheet = p_data.dellSheet; ArrayList projects = new ArrayList(p_projectMap.keySet()); SortUtil.sort(projects);/*from www . java 2 s . co m*/ Iterator projectIter = projects.iterator(); while (projectIter.hasNext()) { String jobName = (String) projectIter.next(); boolean isWrongJob = p_data.wrongJobNames.contains(jobName); HashMap localeMap = (HashMap) p_projectMap.get(jobName); ArrayList locales = new ArrayList(localeMap.keySet()); SortUtil.sort(locales); Iterator localeIter = locales.iterator(); BigDecimal projectTotalWordCountCost = new BigDecimal(BIG_DECIMAL_ZERO_STRING); while (localeIter.hasNext()) { int row = p_row.getValue(); int col = 0; Row theRow = getRow(theSheet, row); String localeName = (String) localeIter.next(); ProjectWorkflowData data = (ProjectWorkflowData) localeMap.get(localeName); CellStyle temp_dateStyle = getDateStyle(p_workbook); CellStyle temp_moneyStyle = getMoneyStyle(p_workbook); CellStyle temp_normalStyle = getContentStyle(p_workbook); // WritableCellFormat temp_wordCountValueRightFormat = // wordCountValueRightFormat; if (data.wasExportFailed) { temp_dateStyle = getFailedDateStyle(p_workbook); temp_moneyStyle = getFailedMoneyStyle(p_workbook); temp_normalStyle = getRedCellStyle(p_workbook); } Cell cell_A = getCell(theRow, col++); cell_A.setCellValue(data.jobId); Cell cell_B = getCell(theRow, col++); cell_B.setCellValue(data.jobName); if (isWrongJob) { cell_A.setCellStyle(getWrongJobStyle(p_workbook)); cell_B.setCellStyle(getWrongJobStyle(p_workbook)); } else { cell_A.setCellStyle(temp_normalStyle); cell_B.setCellStyle(temp_normalStyle); } theSheet.setColumnWidth(col - 2, 5 * 256); theSheet.setColumnWidth(col - 1, 50 * 256); Cell cell_C = getCell(theRow, col++); cell_C.setCellValue(data.poNumber); cell_C.setCellStyle(temp_normalStyle); // PO number Cell cell_D = getCell(theRow, col++); cell_D.setCellValue(data.projectDesc); cell_D.setCellStyle(temp_normalStyle); theSheet.setColumnWidth(col - 1, 22 * 256); /* data.creationDate.toString())); */ Cell cell_E = getCell(theRow, col++); cell_E.setCellValue(data.creationDate); cell_E.setCellStyle(temp_dateStyle); theSheet.setColumnWidth(col - 1, 15 * 256); Cell cell_F = getCell(theRow, col++); cell_F.setCellValue(data.targetLang); cell_F.setCellStyle(temp_normalStyle); Cell cell_G = getCell(theRow, col++); cell_G.setCellValue(data.dellInternalRepsWordCount); cell_G.setCellStyle(temp_normalStyle); int numwidth = 10; theSheet.setColumnWidth(col - 1, numwidth * 256); Cell cell_H = getCell(theRow, col++); cell_H.setCellValue(data.dellExactMatchWordCount); cell_H.setCellStyle(temp_normalStyle); theSheet.setColumnWidth(col - 1, numwidth * 256); if (p_data.headers[0] != null) { Cell cell_InContext = getCell(theRow, col++); cell_InContext.setCellValue(data.dellInContextMatchWordCount); cell_InContext.setCellStyle(temp_normalStyle); theSheet.setColumnWidth(col - 1, numwidth * 256); } Cell cell_FuzzyMatch = getCell(theRow, col++); cell_FuzzyMatch.setCellValue(data.dellFuzzyMatchWordCount); cell_FuzzyMatch.setCellStyle(temp_normalStyle); theSheet.setColumnWidth(col - 1, numwidth * 256); Cell cell_NewWords = getCell(theRow, col++); cell_NewWords.setCellValue(data.dellNewWordsWordCount); cell_NewWords.setCellStyle(temp_normalStyle); theSheet.setColumnWidth(col - 1, numwidth * 256); Cell cell_Total = getCell(theRow, col++); cell_Total.setCellValue(data.dellTotalWordCount); cell_Total.setCellStyle(temp_normalStyle); theSheet.setColumnWidth(col - 1, numwidth * 256); int moneywidth = 12; Cell cell_InternalReps = getCell(theRow, col++); cell_InternalReps.setCellValue(asDouble(data.dellInternalRepsWordCountCost)); cell_InternalReps.setCellStyle(temp_moneyStyle); theSheet.setColumnWidth(col - 1, moneywidth * 256); Cell cell_ExactMatch = getCell(theRow, col++); cell_ExactMatch.setCellValue(asDouble(data.dellExactMatchWordCountCost)); cell_ExactMatch.setCellStyle(temp_moneyStyle); theSheet.setColumnWidth(col - 1, moneywidth * 256); if (p_data.headers[0] != null) { Cell cell_InContext = getCell(theRow, col++); cell_InContext.setCellValue(asDouble(data.dellInContextMatchWordCountCost)); cell_InContext.setCellStyle(temp_moneyStyle); theSheet.setColumnWidth(col - 1, moneywidth * 256); } Cell cell_FuzzyMatch_Invoice = getCell(theRow, col++); cell_FuzzyMatch_Invoice.setCellValue(asDouble(data.dellFuzzyMatchWordCountCost)); cell_FuzzyMatch_Invoice.setCellStyle(temp_moneyStyle); theSheet.setColumnWidth(col - 1, moneywidth * 256); Cell cell_NewWords_Invoice = getCell(theRow, col++); cell_NewWords_Invoice.setCellValue(asDouble(data.dellNewWordsWordCountCost)); cell_NewWords_Invoice.setCellStyle(temp_moneyStyle); theSheet.setColumnWidth(col - 1, moneywidth * 256); Cell cell_Total_Invoice = getCell(theRow, col++); cell_Total_Invoice.setCellValue(asDouble(data.dellTotalWordCountCost)); cell_Total_Invoice.setCellStyle(temp_moneyStyle); theSheet.setColumnWidth(col - 1, moneywidth * 256); p_row.inc(); } } p_row.inc(); p_row.inc(); addTotalsForDellMatches(p_workbook, p_data, p_row, bundle); }