Example usage for org.apache.poi.ss.util CellRangeAddress CellRangeAddress

List of usage examples for org.apache.poi.ss.util CellRangeAddress CellRangeAddress

Introduction

In this page you can find the example usage for org.apache.poi.ss.util CellRangeAddress CellRangeAddress.

Prototype

public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) 

Source Link

Document

Creates new cell range.

Usage

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

License:Apache License

/**
 * For trados style//from   w  w  w  . java  2 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

/**
 * Add totals row//from   w w  w .  j  a va 2 s.c  om
 * 
 * @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.OnlineJobsReportGenerator.java

License:Apache License

private void addHeader(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory) throws Exception {
    String EMEA = CompanyWrapper.getCurrentCompanyName();
    int col = -1;
    Row thirRow = getRow(p_sheet, 2);/*from  w ww  .  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_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.OnlineJobsReportGenerator.java

License:Apache License

/**
 * For trados style/*from   www  .j  a v  a2  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_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 + 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_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_Total = getCell(fourRow, col);
    cell_Total.setCellValue(m_bundle.getString("lb_total"));
    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 + 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.OnlineJobsReportGenerator.java

License:Apache License

/**
 * Add totals row//from  ww  w  .j a v  a2 s .com
 * 
 * @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);
    }

    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);
    }

    // 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.PostReviewQAReportGenerator.java

License:Apache License

private void addCommentStatus(Sheet p_sheet, Set<Integer> rowsWithCommentSet, int last_row) {
    DataValidationHelper dvHelper = p_sheet.getDataValidationHelper();
    DataValidationConstraint dvConstraintAll = null;
    DataValidationConstraint dvConstraintOne = null;
    CellRangeAddressList addressListOne = new CellRangeAddressList();
    CellRangeAddressList addressListAll = new CellRangeAddressList();
    CellRangeAddress cellAddress = null;

    List<String> status = new ArrayList<String>();
    status.addAll(IssueOptions.getAllStatus());
    String[] allStatus = new String[status.size()];
    status.toArray(allStatus);/*from   w  ww  . jav a 2 s .c  o  m*/
    dvConstraintAll = dvHelper.createExplicitListConstraint(allStatus);

    String[] oneStatus = { Issue.STATUS_QUERY };
    dvConstraintOne = dvHelper.createExplicitListConstraint(oneStatus);

    if (rowsWithCommentSet.size() == 0) {
        cellAddress = new CellRangeAddress(SEGMENT_START_ROW, last_row - 1, COMMENT_STATUS_COLUMN,
                COMMENT_STATUS_COLUMN);
        addressListOne.addCellRangeAddress(cellAddress);
        addCommentStatusValidation(p_sheet, dvHelper, dvConstraintOne, addressListOne);
    } else {
        boolean hasComment = false;
        int startRow = SEGMENT_START_ROW;
        int endRow = -1;
        for (int row = SEGMENT_START_ROW; row < last_row; row++) {
            if (rowsWithCommentSet.contains(row)) {
                if (!hasComment && row != SEGMENT_START_ROW) {
                    endRow = row - 1;
                    cellAddress = new CellRangeAddress(startRow, endRow, COMMENT_STATUS_COLUMN,
                            COMMENT_STATUS_COLUMN);
                    addressListOne.addCellRangeAddress(cellAddress);
                    startRow = row;
                }
                hasComment = true;
            } else {
                if (hasComment) {
                    endRow = row - 1;
                    cellAddress = new CellRangeAddress(startRow, endRow, COMMENT_STATUS_COLUMN,
                            COMMENT_STATUS_COLUMN);
                    addressListAll.addCellRangeAddress(cellAddress);
                    startRow = row;
                }
                hasComment = false;
            }

            if (row == last_row - 1) {
                cellAddress = new CellRangeAddress(startRow, last_row - 1, COMMENT_STATUS_COLUMN,
                        COMMENT_STATUS_COLUMN);
                if (hasComment) {
                    addressListAll.addCellRangeAddress(cellAddress);
                } else {
                    addressListOne.addCellRangeAddress(cellAddress);
                }
            }
        }

        addCommentStatusValidation(p_sheet, dvHelper, dvConstraintAll, addressListAll);
        addCommentStatusValidation(p_sheet, dvHelper, dvConstraintOne, addressListOne);
    }
}

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

License:Apache License

/**
 * Creates Monthly Sheet/*w  w w.j  a  v  a2  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.JobAttributeReportHelper.java

License:Apache License

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

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

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

License:Apache License

/**
 * Adds the table header for the Dell Matches sheet
 * //from w  ww.  jav a 2  s .  c o  m
 */
private void addHeaderForDellMatches(Workbook p_workbook) throws Exception {
    Sheet theSheet = data.dellSheet;
    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));
    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));
    c++;
    Cell cell_C = getCell(headerRow, 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(headerRow, 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(headerRow, 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(headerRow, c);
    cell_F.setCellValue(bundle.getString("lb_activity_name"));
    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, 20 * 256);
    c++;
    Cell cell_G = getCell(headerRow, c);
    cell_G.setCellValue(bundle.getString("lb_accepted_reviewer_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, 15 * 256);
    c++;
    Cell cell_H = getCell(headerRow, c);
    cell_H.setCellValue(bundle.getString("lb_lang"));
    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));
    c++;
    Cell cell_I = getCell(headerRow, c);
    cell_I.setCellValue(bundle.getString("lb_word_count"));
    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, 15 * 256);

    c++;
    Cell cell_J = getCell(headerRow, c);
    cell_J.setCellValue(bundle.getString("jobinfo.tmmatches.invoice"));
    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));
    c++;
    Cell cell_K = getCell(headerRow, c);
    cell_K.setCellValue(bundle.getString("lb_tracking"));
    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));
}

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

License:Apache License

/**
 * Adds the table header for the Trados Matches sheet
 * /*from www. ja  v  a  2s .  c o m*/
 */
private void addHeaderForTradosMatches(Workbook p_workbook) throws Exception {
    Sheet theSheet = 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, 0);
    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("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 (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 (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 (data.headers[0] != null) {
        theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 9));
        setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 9), getHeaderStyle(p_workbook));
    } else {
        theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 8));
        setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 8), 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 (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_Invoice = getCell(fourRow, c++);
    cell_Total_Invoice.setCellValue(bundle.getString("lb_translation_total"));
    cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook));

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

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

    Cell cell_Tracking = getCell(thirRow, c);
    cell_Tracking.setCellValue(bundle.getString("lb_tracking"));
    cell_Tracking.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
}