Example usage for org.apache.poi.ss.usermodel Sheet setColumnWidth

List of usage examples for org.apache.poi.ss.usermodel Sheet setColumnWidth

Introduction

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

Prototype

void setColumnWidth(int columnIndex, int width);

Source Link

Document

Set the width (in units of 1/256th of a character width)

The maximum column width for an individual cell is 255 characters.

Usage

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

License:Apache License

/**
 * Add segment header to the sheet for Comments Analysis Report
 * // ww w  .j a  v  a 2  s  .c o  m
 * @param p_workBook
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addSegmentHeader(Workbook p_workBook, Sheet p_sheet) throws Exception {
    int col = 0;
    int row = SEGMENT_HEADER_ROW;
    Row segHeaderRow = getRow(p_sheet, row);
    CellStyle headerStyle = getHeaderStyle(p_workBook);

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

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

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

    for (Select select : categoryList) {
        Cell cell_category = getCell(segHeaderRow, col);
        cell_category.setCellValue(select.getValue());
        cell_category.setCellStyle(headerStyle);
        p_sheet.setColumnWidth(col, 21 * 256);
        col++;
    }

    Cell cell_AVG = getCell(segHeaderRow, col);
    cell_AVG.setCellValue(bundle.getString("lb_avg_score"));
    cell_AVG.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 13 * 256);
    col++;

    Cell cell_Overall = getCell(segHeaderRow, col);
    cell_Overall.setCellValue("Overall");
    cell_Overall.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 10 * 256);
    col++;

    Cell cell_Comments = getCell(segHeaderRow, col);
    cell_Comments.setCellValue(bundle.getString("lb_comments"));
    cell_Comments.setCellStyle(headerStyle);
    p_sheet.setColumnWidth(col, 100 * 256);
    col++;
}

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

License:Apache License

private void addStatisticsSheet(Workbook p_workbook, HashMap<String, HashMap<String, Integer>> socreSum,
        HashMap<String, HashMap<String, Integer>> socreNum, Set<GlobalSightLocale> p_targetLocales,
        DecimalFormat numFormat) throws Exception {
    Sheet statisticsSheet = p_workbook.createSheet("Statistics");
    int row = 0;/*  w  w  w  .  j a v a 2  s.c om*/
    int col = 0;
    //header
    Row headerRow = getRow(statisticsSheet, row);

    CellStyle headerStyle = getHeaderStyle(p_workbook);
    Cell localeHeaderCell = getCell(headerRow, col);
    localeHeaderCell.setCellValue(bundle.getString("lb_target_locale"));
    localeHeaderCell.setCellStyle(headerStyle);
    statisticsSheet.setColumnWidth(col, 14 * 256);
    col++;

    for (Select category : categoryList) {
        Cell categoryCell = getCell(headerRow, col);
        categoryCell.setCellValue(category.getValue());
        categoryCell.setCellStyle(headerStyle);
        statisticsSheet.setColumnWidth(col, 21 * 256);
        col++;
    }

    Cell avgHeaderCell = getCell(headerRow, col);
    avgHeaderCell.setCellValue(bundle.getString("lb_avg_score"));
    avgHeaderCell.setCellStyle(headerStyle);
    statisticsSheet.setColumnWidth(col, 13 * 256);

    HashMap<String, Integer> categoyAvgSum = new HashMap<String, Integer>();
    HashMap<String, Integer> categoyAvgNum = new HashMap<String, Integer>();
    int totalSum = 0;
    int totalNum = 0;
    List<GlobalSightLocale> scortLocales = sortLocales(new ArrayList<GlobalSightLocale>(p_targetLocales));
    //segment
    for (GlobalSightLocale locale : scortLocales) {
        col = 0;
        row++;
        String tl = locale.toString();

        Row scoreRow = getRow(statisticsSheet, row);
        Cell localeCell = getCell(scoreRow, col);
        localeCell.setCellValue(tl);
        localeCell.setCellStyle(contentStyle);
        col++;

        int avgSum = 0;
        int avgNum = 0;
        for (Select category : categoryList) {
            String cv = category.getValue();
            if (socreSum.get(tl).get(cv) != 0) {
                Cell scoreCell = getCell(scoreRow, col);
                double avgScore = (double) socreSum.get(tl).get(cv) / socreNum.get(tl).get(cv);
                scoreCell.setCellValue(Double.parseDouble(numFormat.format(avgScore)));
                scoreCell.setCellStyle(getScoreCellStyle(p_workbook, avgScore));
                col++;
                //Statistics for locale
                avgSum = avgSum + socreSum.get(tl).get(cv);
                avgNum = avgNum + socreNum.get(tl).get(cv);

                //Statistics for category
                if (categoyAvgSum.get(cv) != null) {
                    categoyAvgSum.put(cv, categoyAvgSum.get(cv) + socreSum.get(tl).get(cv));
                    categoyAvgNum.put(cv, categoyAvgNum.get(cv) + socreNum.get(tl).get(cv));
                } else {
                    categoyAvgSum.put(cv, socreSum.get(tl).get(cv));
                    categoyAvgNum.put(cv, socreNum.get(tl).get(cv));
                }

                //Statistics for total
                totalSum = totalSum + socreSum.get(tl).get(cv);
                totalNum = totalNum + socreNum.get(tl).get(cv);
            } else {
                Cell scoreCell = getCell(scoreRow, col);
                scoreCell.setCellValue("");
                scoreCell.setCellStyle(contentStyle);
                col++;
            }
        }

        Cell avgCell = getCell(scoreRow, col);
        if (avgNum > 0) {
            double avgScore = (double) avgSum / avgNum;
            avgCell.setCellValue(Double.parseDouble(numFormat.format(avgScore)));
            avgCell.setCellStyle(getScoreCellStyle(p_workbook, avgScore));
        } else {
            avgCell.setCellValue("");
            avgCell.setCellStyle(contentStyle);
        }
        col++;
    }

    // avg 
    row++;
    col = 0;
    Row avgRow = getRow(statisticsSheet, row);

    Cell avgCell = getCell(avgRow, col);
    if (totalNum != 0) {
        avgCell.setCellValue(bundle.getString("lb_avg_score"));
        avgCell.setCellStyle(contentStyle);
    }
    col++;

    for (Select category : categoryList) {
        Cell categoryAvgCell = getCell(avgRow, col);
        if (categoyAvgSum.get(category.getValue()) != null) {
            double avgScore = (double) categoyAvgSum.get(category.getValue())
                    / categoyAvgNum.get(category.getValue());
            categoryAvgCell.setCellValue(Double.parseDouble(numFormat.format(avgScore)));
            categoryAvgCell.setCellStyle(getScoreCellStyle(p_workbook, avgScore));
        }
        col++;
    }

    Cell totalAvgCell = getCell(avgRow, col);
    double avgScore = 0;
    if (totalNum != 0) {
        avgScore = (double) totalSum / totalNum;
        totalAvgCell.setCellValue(Double.parseDouble(numFormat.format(avgScore)));
        totalAvgCell.setCellStyle(getScoreCellStyle(p_workbook, avgScore));
    }
}

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

License:Apache License

/**
 * Creates Monthly Sheet/*from   w  ww  .  j ava 2  s.c o  m*/
 */
private void createMonthlySheet(Workbook p_workbook, Sheet p_sheet, ReportSearchOptions p_options,
        Map<String, ReportWordCount> p_wordCounts) throws Exception {
    List<String> searchMonths = p_options.getMonths();

    CellStyle style = getHeaderStyle(p_workbook);

    CellStyle style1 = getHeaderStyle(p_workbook, null, null, null, null);

    CellStyle styleTB = getHeaderStyle(p_workbook, CellStyle.BORDER_THIN, null, CellStyle.BORDER_THIN, null);

    CellStyle styleTB2 = getHeaderStyle(p_workbook, CellStyle.BORDER_THIN, null, CellStyle.BORDER_THIN, null);
    styleTB2.setAlignment(CellStyle.ALIGN_RIGHT);

    CellStyle styleLR = getHeaderStyle(p_workbook, null, CellStyle.BORDER_THIN, null, CellStyle.BORDER_THIN);

    int row = ROWNUMBER, column = 0;

    p_sheet.setColumnWidth(0, 12 * 256);

    Cell cell_A_Header = getCell(getRow(p_sheet, row), column++);
    cell_A_Header.setCellValue(bundle.getString("lb_sumOfTotal"));
    cell_A_Header.setCellStyle(style);
    p_sheet.addMergedRegion(new CellRangeAddress(row, row, column, column + searchMonths.size()));
    setRegionStyle(p_sheet, new CellRangeAddress(row, row, column, column + searchMonths.size()), style);
    Cell cell_B_Header = getCell(getRow(p_sheet, row), column);
    cell_B_Header.setCellValue(bundle.getString("lb_month"));
    cell_B_Header.setCellStyle(style);

    row++;
    column = 0;
    Cell cell_A = getCell(getRow(p_sheet, row), column++);
    cell_A.setCellValue(bundle.getString("lb_lang"));
    cell_A.setCellStyle(style);
    for (String yearAndMonth : searchMonths) {
        Cell cell_Month = getCell(getRow(p_sheet, row), column++);
        cell_Month.setCellValue(Double.valueOf(yearAndMonth.substring(4)));
        cell_Month.setCellStyle(styleTB);
    }
    p_sheet.setColumnWidth(column, 10 * 256);
    Cell cell_LocaleTotal = getCell(getRow(p_sheet, row), column++);
    cell_LocaleTotal.setCellValue(bundle.getString("lb_grandTotal"));
    cell_LocaleTotal.setCellStyle(style);

    // Adds a hidden column, for Excel Sum Check Error.
    Row hiddenRow = getRow(p_sheet, ++row);
    hiddenRow.setZeroHeight(isHidden);
    getRow(p_sheet, row - 1).setHeight(p_sheet.getDefaultRowHeight());

    int dataRow = ++row;
    column = 0;
    double totalWordCount = 0;
    Set<String> locales = getLocals(p_wordCounts);
    for (String locale : locales) {
        Cell cell_A_Locale = getCell(getRow(p_sheet, row), column++);
        cell_A_Locale.setCellValue(locale);
        cell_A_Locale.setCellStyle(styleLR);
        for (String yearAndMonth : searchMonths) {
            ReportWordCount reportWordCount = p_wordCounts.get(getWordCountMapKey(locale, yearAndMonth));
            if (reportWordCount != null) {
                totalWordCount = reportWordCount.getTradosTotalWordCount();
            }
            addNumberCell(p_sheet, column++, row, totalWordCount, style1);
            totalWordCount = 0;
        }
        Cell cell_LocaleTotal_Month = getCell(getRow(p_sheet, row), column);
        cell_LocaleTotal_Month.setCellFormula(getSumOfRow(1, column - 1, row));
        cell_LocaleTotal_Month.setCellStyle(styleLR);
        row++;
        column = 0;
    }

    if (row > (ROWNUMBER + 3)) {
        column = 0;
        Cell cell_GrandTotal = getCell(getRow(p_sheet, row), column++);
        cell_GrandTotal.setCellValue(bundle.getString("lb_grandTotal"));
        cell_GrandTotal.setCellStyle(style);
        for (int i = 0; i < searchMonths.size(); i++) {
            Cell cell_MonthTotal = getCell(getRow(p_sheet, row), column);
            cell_MonthTotal.setCellFormula(getSumOfColumn(dataRow, row - 1, column));
            cell_MonthTotal.setCellStyle(styleTB);
            column++;
        }
        Cell cell_Total = getCell(getRow(p_sheet, row), column);
        cell_Total.setCellFormula(getSumOfColumn(dataRow, row - 1, column));
        cell_Total.setCellStyle(style);
    }
}

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

License:Apache License

private void addLeveragingSheetHeader(Workbook p_workbook, Sheet p_sheet) throws Exception {
    int row = ROWNUMBER, column = 0;

    Row thirRow = getRow(p_sheet, row);/* w  ww.j a  v a 2s.  c  om*/
    Cell cell_A = getCell(thirRow, column++);
    cell_A.setCellValue(bundle.getString("lb_lang"));
    cell_A.setCellStyle(getHeaderOrangeStyle(p_workbook));

    Cell cell_B = getCell(thirRow, column++);
    cell_B.setCellValue(bundle.getString("jobinfo.tradosmatches.invoice.per100matches"));
    cell_B.setCellStyle(getHeaderOrangeStyle(p_workbook));

    Cell cell_C = getCell(thirRow, column++);
    cell_C.setCellValue(bundle.getString("lb_95_99"));
    cell_C.setCellStyle(getHeaderOrangeStyle(p_workbook));

    Cell cell_D = getCell(thirRow, column++);
    cell_D.setCellValue(bundle.getString("lb_85_94"));
    cell_D.setCellStyle(getHeaderOrangeStyle(p_workbook));

    Cell cell_E = getCell(thirRow, column++);
    cell_E.setCellValue(bundle.getString("lb_75_84"));
    cell_E.setCellStyle(getHeaderOrangeStyle(p_workbook));

    Cell cell_F = getCell(thirRow, column++);
    cell_F.setCellValue(bundle.getString("lb_no_match"));
    cell_F.setCellStyle(getHeaderOrangeStyle(p_workbook));

    p_sheet.setColumnWidth(column, 10 * 256);
    Cell cell_G = getCell(thirRow, column++);
    cell_G.setCellValue(bundle.getString("lb_repetition_word_cnt"));
    cell_G.setCellStyle(getHeaderOrangeStyle(p_workbook));

    if (headers[0] != null) {
        p_sheet.setColumnWidth(column, 10 * 256);
        Cell cell_InContext = getCell(thirRow, column++);
        cell_InContext.setCellValue(bundle.getString("lb_in_context_tm"));
        cell_InContext.setCellStyle(getHeaderOrangeStyle(p_workbook));
    }
    if (headers[1] != null) {
        p_sheet.setColumnWidth(column, 10 * 256);
        Cell cell_Context = getCell(thirRow, column++);
        cell_Context.setCellValue(bundle.getString("lb_context_matches"));
        cell_Context.setCellStyle(getHeaderOrangeStyle(p_workbook));
    }

    Cell cell_Total = getCell(thirRow, column++);
    cell_Total.setCellValue(bundle.getString("lb_total"));
    cell_Total.setCellStyle(getHeaderOrangeStyle(p_workbook));

    p_sheet.setColumnWidth(column, 13 * 256);
    Cell cell_Leveraging = getCell(thirRow, column++);
    cell_Leveraging.setCellValue(bundle.getString("lb_leveraging"));
    cell_Leveraging.setCellStyle(getHeaderOrangeStyle(p_workbook));
}

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

License:Apache License

/**
 * Creates Leveraging Sheet/*from   w w  w. j ava  2 s .  co  m*/
 */
private void createCostsSheet(Workbook p_workbook, Sheet p_sheet, ReportSearchOptions p_options,
        Map<String, ReportWordCount> p_wordCounts) throws Exception {
    int rowLen = p_sheet.getPhysicalNumberOfRows();
    int colLen = p_sheet.getRow(2).getPhysicalNumberOfCells();
    int wordTotalCol = colLen - 2;
    int row = ROWNUMBER, column = colLen - 1;
    int costCol;
    Map<String, Double> p_ratesMap = null;
    for (int r = 2; r < rowLen + ROWNUMBER; r++) {
        Row theRow = getRow(p_sheet, r);
        theRow.removeCell(getCell(theRow, column));
    }
    p_sheet.removeColumnBreak(column);
    // Rates Columns
    for (int dis = column - 1; column < colLen + dis - 2; column++) {
        Cell cell_From = p_sheet.getRow(row).getCell(column - dis);
        Cell cell_To = getCell(p_sheet.getRow(row), column);
        cell_To.setCellValue(cell_From.getStringCellValue());
        cell_To.setCellStyle(cell_From.getCellStyle());
        p_sheet.setColumnWidth(column, p_sheet.getColumnWidth(column - dis));
        // Adds Rates for Match Type
        for (int rateRow = row + 1; rateRow <= rowLen; rateRow++) {
            String matchType = p_sheet.getRow(ROWNUMBER).getCell(column).getStringCellValue();
            String targetLocale = p_sheet.getRow(rateRow).getCell(0).getStringCellValue();
            double rate = getRate(matchType, targetLocale, p_ratesMap);
            addNumberCell(p_sheet, column, rateRow, rate, getMoneyStyle(p_workbook));
        }
    }

    // Cost Columns Head
    costCol = column;
    p_sheet.setColumnWidth(column, 20 * 256);
    Cell cell_CostWithLeveraging = getCell(getRow(p_sheet, row), column++);
    cell_CostWithLeveraging.setCellValue(bundle.getString("lb_report_costWithLeveraging"));
    cell_CostWithLeveraging.setCellStyle(getHeaderOrangeStyle(p_workbook));

    p_sheet.setColumnWidth(column, 20 * 256);
    Cell cell_CostNoLeveraging = getCell(getRow(p_sheet, row), column++);
    cell_CostNoLeveraging.setCellValue(bundle.getString("lb_report_costNoLeveraging"));
    cell_CostNoLeveraging.setCellStyle(getHeaderOrangeStyle(p_workbook));

    p_sheet.setColumnWidth(column, 15 * 256);
    Cell cell_Savings = getCell(getRow(p_sheet, row), column++);
    cell_Savings.setCellValue(bundle.getString("lb_savings"));
    cell_Savings.setCellStyle(getHeaderOrangeStyle(p_workbook));

    Cell cell_Percent = getCell(getRow(p_sheet, row), column++);
    cell_Percent.setCellValue("%");
    cell_Percent.setCellStyle(getHeaderOrangeStyle(p_workbook));
    // Cost Columns Data
    for (row = ROWNUMBER + 1; row < (rowLen + ROWNUMBER); row++) {
        String leveragingForm = getCostWithLeveraging(1, wordTotalCol - 1, wordTotalCol, (row + 1));
        String noLeveragingForm = getColumnName(wordTotalCol) + (row + 1) + "*"
                + getColumnName(wordTotalCol + 5) + (row + 1);
        String savingForm = getColumnName(costCol + 1) + (row + 1) + "-" + getColumnName(costCol) + (row + 1);
        String percent = getColumnName(costCol + 2) + (row + 1) + "/" + getColumnName(costCol + 1) + (row + 1);

        Row theRow = getRow(p_sheet, row);
        Cell cell_Leveraging = getCell(theRow, costCol);
        cell_Leveraging.setCellFormula(leveragingForm);
        cell_Leveraging.setCellStyle(getMoneyStyle(p_workbook));

        Cell cell_NoLeveraging = getCell(theRow, costCol + 1);
        cell_NoLeveraging.setCellFormula(noLeveragingForm);
        cell_NoLeveraging.setCellStyle(getMoneyStyle(p_workbook));

        Cell cell_Saving = getCell(theRow, costCol + 2);
        cell_Saving.setCellFormula(savingForm);
        cell_Saving.setCellStyle(getMoneyStyle(p_workbook));

        Cell cell_PercentData = getCell(theRow, costCol + 3);
        cell_PercentData.setCellFormula(percent);
        cell_PercentData.setCellStyle(getPercentStyle(p_workbook));
    }

    if (rowLen > 1) {
        row = rowLen + 1;
        column = 1;
        for (; column < colLen - 1; column++) {
            Cell cell_Total = getCell(getRow(p_sheet, row), column);
            cell_Total.setCellFormula(getSumOfColumn(ROWNUMBER + 1, row - 1, column));
            cell_Total.setCellStyle(getHeaderOrangeStyle(p_workbook));
        }
        for (; column < costCol; column++) {
            Cell cell = getCell(getRow(p_sheet, row), column);
            cell.setCellValue("");
            cell.setCellStyle(getHeaderOrangeStyle(p_workbook));
        }

        // Summary Cost Columns
        Cell cell_SumLeveraging = getCell(getRow(p_sheet, row), column);
        cell_SumLeveraging.setCellFormula(getSumOfColumn(ROWNUMBER + 1, row - 1, column++));
        cell_SumLeveraging.setCellStyle(getMoneySumStyle(p_workbook));

        Cell cell_SumNoLeveraging = getCell(getRow(p_sheet, row), column);
        cell_SumNoLeveraging.setCellFormula(getSumOfColumn(ROWNUMBER + 1, row - 1, column++));
        cell_SumNoLeveraging.setCellStyle(getMoneySumStyle(p_workbook));

        Cell cell_SumSaving = getCell(getRow(p_sheet, row), column);
        cell_SumSaving.setCellFormula(getSumOfColumn(ROWNUMBER + 1, row - 1, column++));
        cell_SumSaving.setCellStyle(getMoneySumStyle(p_workbook));

        String percent = getColumnName(column - 1) + (row + 1) + "/" + getColumnName(column - 2) + (row + 1);
        Cell cell_AvgPercent = getCell(getRow(p_sheet, row), column);
        cell_AvgPercent.setCellFormula(percent);
        cell_AvgPercent.setCellStyle(getPercentSumStyle(p_workbook));
    }
}

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

License:Apache License

private void createCriteriaSheet(Workbook p_workbook, Sheet p_sheet, ReportSearchOptions p_options,
        Map<String, ReportWordCount> p_wordCounts) throws Exception {
    StringBuffer temp = new StringBuffer();
    int row = -1;
    String mark = ": ";
    p_sheet.setColumnWidth(0, 20 * 256);
    p_sheet.setColumnWidth(1, 50 * 256);
    Cell cell_A_Title = getCell(getRow(p_sheet, ++row), 0);
    cell_A_Title.setCellValue(bundle.getString("lb_report_criteria"));
    cell_A_Title.setCellStyle(getContentStyle(p_workbook));

    Cell cell_CompanyName = getCell(getRow(p_sheet, ++row), 0);
    cell_CompanyName.setCellValue(bundle.getString("lb_company_name") + mark);
    cell_CompanyName.setCellStyle(getContentStyle(p_workbook));

    Cell cell_CompanyNameData = getCell(getRow(p_sheet, row), 1);
    cell_CompanyNameData.setCellValue(p_options.getCurrentCompanyName());
    cell_CompanyNameData.setCellStyle(getContentStyle(p_workbook));

    Cell cell_StartDate = getCell(getRow(p_sheet, ++row), 0);
    cell_StartDate.setCellValue(bundle.getString("lb_report_startDate") + mark);
    cell_StartDate.setCellStyle(getContentStyle(p_workbook));

    Cell cell_StartDateData = getCell(getRow(p_sheet, row), 1);
    cell_StartDateData.setCellValue(p_options.getStartDateStr());
    cell_StartDateData.setCellStyle(getContentStyle(p_workbook));

    Cell cell_EndDate = getCell(getRow(p_sheet, ++row), 0);
    cell_EndDate.setCellValue(bundle.getString("lb_report_endDate") + mark);
    cell_EndDate.setCellStyle(getContentStyle(p_workbook));

    Cell cell_EndDateData = getCell(getRow(p_sheet, row), 1);
    cell_EndDateData.setCellValue(p_options.getEndDateStr());
    cell_EndDateData.setCellStyle(getContentStyle(p_workbook));

    // Project Search option
    Cell cell_Project = getCell(getRow(p_sheet, ++row), 0);
    cell_Project.setCellValue(bundle.getString("lb_project") + mark);
    cell_Project.setCellStyle(getContentStyle(p_workbook));
    if (p_options.isAllProjects()) {
        temp.setLength(0);/*from  w ww .  j  a va  2 s  .  c  om*/
        temp.append(bundle.getString("lb_all"));
    } else {
        temp.setLength(0);
        for (long projectId : p_options.getProjectIdList()) {
            Project proj = ServerProxy.getProjectHandler().getProjectById(projectId);
            temp.append(proj.getName()).append(",");
        }
        temp = new StringBuffer(temp.substring(0, temp.length() - 1));
    }
    Cell cell_ProjectData = getCell(getRow(p_sheet, row), 1);
    cell_ProjectData.setCellValue(temp.toString());
    cell_ProjectData.setCellStyle(getContentStyle(p_workbook));

    // Status Search option
    Cell cell_Status = getCell(getRow(p_sheet, ++row), 0);
    cell_Status.setCellValue(bundle.getString("lb_status") + mark);
    cell_Status.setCellStyle(getContentStyle(p_workbook));
    if (p_options.isAllJobStatus()) {
        temp.setLength(0);
        temp.append(bundle.getString("lb_all"));
    } else {
        temp.setLength(0);
        for (String status : p_options.getJobStatusList()) {
            temp.append(ReportHelper.getJobStatusDisplayName(status)).append(",");
        }
        temp = new StringBuffer(temp.substring(0, temp.length() - 1));
    }
    Cell cell_StatusData = getCell(getRow(p_sheet, row), 1);
    cell_StatusData.setCellValue(temp.toString());
    cell_StatusData.setCellStyle(getContentStyle(p_workbook));

    // Target Locales Search option
    Cell cell_TargetLang = getCell(getRow(p_sheet, ++row), 0);
    cell_TargetLang.setCellValue(bundle.getString("lb_target_language") + mark);
    cell_TargetLang.setCellStyle(getContentStyle(p_workbook));
    if (p_options.isAllTargetLangs()) {

        temp.setLength(0);
        temp.append(bundle.getString("lb_all"));
    } else {
        temp.setLength(0);
        for (GlobalSightLocale gl : p_options.getTargetLocaleList()) {
            temp.append(gl.getDisplayName()).append(",");
        }
        temp = new StringBuffer(temp.substring(0, temp.length() - 1));
    }
    Cell cell_TargetLangData = getCell(getRow(p_sheet, row), 1);
    cell_TargetLangData.setCellValue(temp.toString());
    cell_TargetLangData.setCellStyle(getContentStyle(p_workbook));

    // Currency Search Option
    Cell cell_Currency = getCell(getRow(p_sheet, ++row), 0);
    cell_Currency.setCellValue(bundle.getString("lb_currency") + mark);
    cell_Currency.setCellStyle(getContentStyle(p_workbook));

    Cell cell_CurrencyData = getCell(getRow(p_sheet, row), 1);
    cell_CurrencyData.setCellValue(p_options.getCurrency());
    cell_CurrencyData.setCellStyle(getContentStyle(p_workbook));
}

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

License:Apache License

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

License:Apache License

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

License:Apache License

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

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

License:Apache License

/**
 * Adds the table header to the sheet/*  w ww  .ja va 2 s. c  o  m*/
 * 
 * @param p_sheet
 *            the sheet to be created in the report
 * 
 * @throws Exception
 */
private void addHeader(Workbook p_workbook, Sheet p_sheet) throws Exception {
    CellStyle headerCs = getHeaderStyle(p_workbook);

    int col = 0;
    Row headerRow = getRow(p_sheet, 3);

    Cell cell_A = getCell(headerRow, col++);
    cell_A.setCellValue(bundle.getString("jobinfo.jobid"));
    cell_A.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 10 * 256);

    Cell cell_B = getCell(headerRow, col++);
    cell_B.setCellValue(bundle.getString("lb_job"));
    cell_B.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 50 * 256);

    Cell cell_C = getCell(headerRow, col++);
    cell_C.setCellValue(bundle.getString("lb_lang"));
    cell_C.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_D = getCell(headerRow, col++);
    cell_D.setCellValue(bundle.getString("lb_word_count"));
    cell_D.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 20 * 256);

    Cell cell_E = getCell(headerRow, col++);
    cell_E.setCellValue(bundle.getString("lb_job_kickoff_date"));
    cell_E.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_F = getCell(headerRow, col++);
    cell_F.setCellValue(bundle.getString("lb_date_due_to_review"));
    cell_F.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_G = getCell(headerRow, col++);
    cell_G.setCellValue(bundle.getString("lb_actual_date_to_review"));
    cell_G.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_H = getCell(headerRow, col++);
    cell_H.setCellValue(bundle.getString("lb_current_activity"));
    cell_H.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 20 * 256);

    Cell cell_I = getCell(headerRow, col++);
    cell_I.setCellValue(bundle.getString("lb_reviewer_accepted"));
    cell_I.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_J = getCell(headerRow, col++);
    cell_J.setCellValue(bundle.getString("lb_reviewer_name"));
    cell_J.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 20 * 256);

    Cell cell_K = getCell(headerRow, col++);
    cell_K.setCellValue(bundle.getString("lb_Due_reviewer_complete"));
    cell_K.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_L = getCell(headerRow, col++);
    cell_L.setCellValue(bundle.getString("lb_actual_reviewer_complete"));
    cell_L.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_M = getCell(headerRow, col++);
    cell_M.setCellValue(bundle.getString("jobinfo.status.estimatedjobcompletion"));
    cell_M.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_N = getCell(headerRow, col++);
    cell_N.setCellValue(bundle.getString("jobinfo.status.actualjobcompletion"));
    cell_N.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);

    Cell cell_O = getCell(headerRow, col++);
    cell_O.setCellValue(bundle.getString("lb_pm"));
    cell_O.setCellStyle(headerCs);
    p_sheet.setColumnWidth(col - 1, 25 * 256);
}