Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfPTable


            Image image = Image.getInstance( DroolsDocsBuilder.class.getResource( "drools-guvnor.png" ) );
            image.setAlignment( Image.RIGHT );
            image.scaleAbsolute( 100,
                                 30 );
            Rectangle page = document.getPageSize();
            PdfPTable head = new PdfPTable( 2 );

            PdfPCell cell1 = new PdfPCell( image );
            cell1.setHorizontalAlignment( Element.ALIGN_LEFT );
            cell1.setBorder( 0 );

            head.addCell( cell1 );

            PdfPCell cell2 = new PdfPCell( new Phrase( currentDate,
                                                       DroolsDocsComponentFactory.HEADER_FOOTER_TEXT ) );
            cell2.setHorizontalAlignment( Element.ALIGN_RIGHT );
            cell2.setBorder( 0 );

            head.addCell( cell2 );

            head.setTotalWidth( page.getWidth() - document.leftMargin() - document.rightMargin() );
            head.writeSelectedRows( 0,
                                    -1,
                                    document.leftMargin(),
                                    page.getHeight() - document.topMargin() + head.getTotalHeight(),
                                    writer.getDirectContent() );

        } catch ( Exception e ) {
            throw new ExceptionConverter( e );
        }
View Full Code Here


            doc.add(pData);
            doc.add(Chunk.NEWLINE);

            // Generates the data table
            int rowNo = 5;
            PdfPTable dataTableHeader = new PdfPTable(rowNo);
            PdfPCell dataTblHeaderCell;

            Phrase pTemp = new Phrase("NODE", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            dataTblHeaderCell = new PdfPCell(pTemp);
            dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            dataTableHeader.addCell(dataTblHeaderCell);
            pTemp = new Phrase("DEPTH"+"\n"+"(m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            dataTblHeaderCell = new PdfPCell(pTemp);
            dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            dataTableHeader.addCell(dataTblHeaderCell);
            pTemp = new Phrase("MODULUS OF SUBGRADE REACTION"+"\n"+"(kN/m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            dataTblHeaderCell = new PdfPCell(pTemp);
            dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            dataTableHeader.addCell(dataTblHeaderCell);
            pTemp = new Phrase("LATERAL SOIL MOVEMENTS"+"\n"+"(m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            dataTblHeaderCell = new PdfPCell(pTemp);
            dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            dataTableHeader.addCell(dataTblHeaderCell);
            pTemp = new Phrase("LIMIT SOIL PRESSURE"+"\n"+"(kN/m²)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            dataTblHeaderCell = new PdfPCell(pTemp);
            dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            dataTableHeader.addCell(dataTblHeaderCell);

            PdfPCell dataTblCell;
           
            PdfPTable dataTable = new PdfPTable(rowNo);
            for (int i = 0; i <= data.getNumOfElements(); i++) {

                Phrase pNode = new Phrase(Integer.toString(i), FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
                dataTblCell = new PdfPCell(pNode);
                dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                dataTable.addCell(dataTblCell);
                Phrase pPileNodeCoord = new Phrase(Double.toString(data.getPileNodeCoordinate(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                dataTblCell = new PdfPCell(pPileNodeCoord);
                dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                dataTable.addCell(dataTblCell);
                Phrase pModOfSub = new Phrase(Double.toString(data.getModOfSubgradeReaction(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                dataTblCell = new PdfPCell(pModOfSub);
                dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                dataTable.addCell(dataTblCell);
                Phrase pLateralSoilMov = new Phrase(Double.toString(data.getLateralSoilMovement(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                dataTblCell = new PdfPCell(pLateralSoilMov);
                dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                dataTable.addCell(dataTblCell);
                Phrase pLimitSoilPress = new Phrase(Double.toString(data.getLimitSoilPressure(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                dataTblCell = new PdfPCell(pLimitSoilPress);
                dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                dataTable.addCell(dataTblCell);
              
            }
            doc.add(dataTableHeader);
            doc.add(dataTable);
            doc.newPage();

            // Create the title for the result table
            Chunk theResultTable = new Chunk("The Result Table", new Font(Font.TIMES_ROMAN, 18, Font.BOLD));
            Paragraph pResult = new Paragraph(theResultTable);
            pResult.setAlignment(Element.ALIGN_CENTER);
            doc.add(pResult);
            doc.add(Chunk.NEWLINE);

            // Generates the result table
            rowNo = 9;
            PdfPTable resultTableHeader = new PdfPTable(rowNo);
            PdfPCell resultTblHeaderCell;

            pTemp = new Phrase("NODE", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("DEPTH"+"\n"+"(m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("SOIL MOVEMENT"+"\n"+"(mm)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("SOIL PRESSURE"+"\n"+"(kPa)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("ABS"+"\n"+"SOIL PRESSURE"+"\n"+"(kPa)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("DISPLACEMENT"+"\n"+"(mm)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("ROTATION"+"\n"+"(rad)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("BENDING MOMENT"+"\n"+"(kNm)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);
            pTemp = new Phrase("SHEAR FORCE"+"\n"+"(kN)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
            resultTblHeaderCell = new PdfPCell(pTemp);
            resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            resultTableHeader.addCell(resultTblHeaderCell);

            PdfPTable resultTable = new PdfPTable(rowNo);
            PdfPCell resultTblCell;
           
            for (int i = 0; i < data.getNumOfElements() + 1; i++) {
               
                Phrase pNodes = new Phrase(Integer.toString(i), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD));
                resultTblCell = new PdfPCell(pNodes);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pPileNodeCoord = new Phrase(Double.toString(data.getPileNodeCoordinate(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pPileNodeCoord);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pSoilMov = new Phrase(Double.toString(result.getSoilMovement(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pSoilMov);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pSoilPress = new Phrase(Double.toString(result.getSoilPressure(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pSoilPress);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pLimitPressure = new Phrase(Double.toString(result.getLimitPressure(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pLimitPressure);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pDisplacement = new Phrase(Double.toString(result.getDisplacement(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pDisplacement);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pRotation = new Phrase(Double.toString(result.getRotation(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pRotation);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pBendingMoment = new Phrase(Double.toString(result.getBendingMoment(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pBendingMoment);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
                Phrase pShearForce = new Phrase(Double.toString(result.getShearForce(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
                resultTblCell = new PdfPCell(pShearForce);
                resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                resultTable.addCell(resultTblCell);
               
            }
            doc.add(resultTableHeader);
            doc.add(resultTable);
View Full Code Here

    }
    return gestionDtoTable;
  }
 
  private PdfPTable addBudget(String budget){
    PdfPTable budgetTable = new PdfPTable(2);
    PdfPCell budgetCell;
    String[] tmp = budget.split(Constants.SEPRATE);
    float[] wf = {
        12,   //CR 3
        17// Niveau de risque 5
      };
    try {
      budgetTable.setWidths(wf);
    } catch (DocumentException e) {
      e.printStackTrace();
    }
 
    budgetCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.gestiondto.content.budgetinitial",null,localtion), contentNormalFont));
    budgetCell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
    budgetTable.addCell(budgetCell);
    budgetTable.addCell(new PdfPCell(new Phrase(tmp[0].equals("null") ? "" : tmp[0] , contentNormalFont)));
   
    budgetCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.gestiondto.content.ecartdernierpoint",null,localtion), contentNormalFont));
    budgetCell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
    budgetTable.addCell(budgetCell);
    budgetTable.addCell(new PdfPCell(new Phrase(tmp[1].equals("null") ? "" : tmp[1], contentNormalFont)));
   
    budgetCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.gestiondto.content.datedernier",null,localtion), contentNormalFont));
    budgetCell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
    budgetTable.addCell(budgetCell);
    budgetTable.addCell(new PdfPCell(new Phrase(tmp[2].equals("null") ? "" : tmp[2], contentNormalFont)));
    budgetTable.setWidthPercentage(50f);
   
   
    PdfPTable gestionDtoTable = new PdfPTable(3);
    PdfPCell gestionDtoCell;
 
    gestionDtoCell = new PdfPCell();
    gestionDtoCell.setBorder(Rectangle.NO_BORDER);
    gestionDtoTable.addCell(gestionDtoCell);
   
    gestionDtoCell = new PdfPCell(budgetTable);
    gestionDtoCell.setBorder(Rectangle.NO_BORDER);
    gestionDtoTable.addCell(gestionDtoCell);
   
    gestionDtoCell = new PdfPCell();
    gestionDtoCell.setBorder(Rectangle.NO_BORDER);
    gestionDtoTable.addCell(gestionDtoCell);
 
    float[] wf1 = {
        79,
        29,
        7
      };
    try {
      gestionDtoTable.setWidthPercentage(100f);
      gestionDtoTable.setWidths(wf1);
    } catch (DocumentException e) {
      e.printStackTrace();
    }
    return gestionDtoTable;
  }
View Full Code Here

 
 
  //Add Process Report
  private void addProcessDto() throws DocumentException {   

    PdfPTable headerTable = new PdfPTable(1);
    headerTable.setWidthPercentage(100f);
    PdfPCell headerCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.suvidesavancements", null, localtion), contentBoldFont));
    headerCell.setBorder(Rectangle.NO_BORDER);
    headerTable.addCell(headerCell);
    headerTable.setSpacingAfter(0f);
    addContent(headerTable);
   
    headerTable = new PdfPTable(2);
    headerTable.setWidthPercentage(40f);
    headerTable.setHorizontalAlignment(Rectangle.ALIGN_LEFT);
    headerTable.setSpacingAfter(15f);
    float[] wf1 = {
        5,10 };
    headerCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.etatdavancement", null, localtion) + " : ", contentBoldFont));
    headerCell.setBorder(Rectangle.NO_BORDER);
    headerTable.addCell(headerCell);
   
    headerCell = new PdfPCell(new Phrase(etatAvancement + " " + messageSource.getMessage("pdf.process.titlebox.percentavancementmarche", null, localtion), contentNormalFont));
    headerCell.setBorder(Rectangle.NO_BORDER);
    headerTable.addCell(headerCell);
    headerTable.setSpacingAfter(0f);
    headerTable.setWidths(wf1);
    addContent(headerTable);
   
    PdfPTable parent = new PdfPTable(3);
    parent.setSpacingBefore(0f);
    parent.setWidthPercentage(100f);
    float[] wfParent = {
        70,
        5,
        25
      };
    parent.setWidths(wfParent);
    PdfPCell cellLeft,cellMiddle,cellRight;
   
    /////////
    //Add Group Header
    PdfPCell[] groupHeaderCell = new PdfPCell[3];
    groupHeaderCell[0] = new PdfPCell();
    groupHeaderCell[0].setBorder(Rectangle.NO_BORDER);
   
    groupHeaderCell[1] = new PdfPCell(new Phrase("ADVANCEMENT", contentBoldFont));
    groupHeaderCell[1].setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));

    groupHeaderCell[2] = new PdfPCell(new Phrase("RETENUES", contentBoldFont));
    groupHeaderCell[2].setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
   
    float[] wfGroupHeader = {
        25,
        20,
        20
      };
    for (PdfPCell pdfPCell : groupHeaderCell) {
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }

    PdfPTable groupHeaderTable = new PdfPTable(3);
    groupHeaderTable.setWidthPercentage(100f);
    groupHeaderTable.setWidths(wfGroupHeader);
    addCellsToTable(groupHeaderTable,groupHeaderCell);
   
    cellLeft = new PdfPCell(groupHeaderTable);
    cellLeft.setBorder(Rectangle.NO_BORDER);
    parent.addCell(cellLeft);
   
    cellMiddle = new PdfPCell();
    cellMiddle.setBorder(Rectangle.NO_BORDER);
    parent.addCell(cellMiddle);
   
    cellRight = new PdfPCell(new Phrase("Commentaires / Informations : ", contentBoldFont));
    cellRight.setBorder(Rectangle.NO_BORDER);
    parent.addCell(cellRight);
   
    //Header
    //create table header
    PdfPCell[] processTableHeader = new PdfPCell[7];
    processTableHeader[0] = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.number", null, localtion), contentBoldFont));
    processTableHeader[1] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.libelle", null, localtion), contentBoldFont));
    processTableHeader[2] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.date", null, localtion), contentBoldFont));
    processTableHeader[3] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.cumule", null, localtion), contentBoldFont));
    processTableHeader[4] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.mois", null, localtion), contentBoldFont));
    processTableHeader[5] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.cumule", null, localtion), contentBoldFont));
    processTableHeader[6] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.mois", null, localtion), contentBoldFont));
   
    for (PdfPCell pdfPCell : processTableHeader) {
      pdfPCell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }
    //End
    PdfPTable processDtoTable = new PdfPTable(7);
    processDtoTable.setWidthPercentage(100f);
    addCellsToTable(processDtoTable, processTableHeader);
   
    float[] wf = {
        5,   //No 3
        10//Libellé risque codification
        10,   //Origine de détection
        10,   //CR 3
        10// Niveau de risque 5
        10,
        10
      };
    processDtoTable.setWidthPercentage(70f);
    processDtoTable.setWidths(wf);
    processDtoTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);

    cellLeft = new PdfPCell(processDtoTable);
    cellLeft.setBorder(Rectangle.NO_BORDER);
    parent.addCell(cellLeft);
   
    cellMiddle = new PdfPCell();
    cellMiddle.setBorder(Rectangle.NO_BORDER);
   
    parent.addCell(cellMiddle);
   
    cellRight = new PdfPCell();
    cellRight.setBorder(Rectangle.NO_BORDER);
    cellRight.enableBorderSide(Rectangle.TOP);
    cellRight.enableBorderSide(Rectangle.RIGHT);
    cellRight.enableBorderSide(Rectangle.LEFT);
    parent.addCell(cellRight);
    processDtoTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
   
    String tmp;
    processDtoTable = new PdfPTable(7);
    if(processes !=null && processes.length() > 0){
      String arr[] = processes.split(Constants.SEPRATE);
      for(int i=0;i < arr.length;i++){
        tmp = arr[i];
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp, contentNormalFont)));
      }
      processDtoTable.setWidthPercentage(70f);
      processDtoTable.setWidths(wf);
      processDtoTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    }
    cellLeft = new PdfPCell(processDtoTable);
    parent.addCell(cellLeft);
   
    cellMiddle = new PdfPCell();
    cellMiddle.setBorder(Rectangle.NO_BORDER);
    parent.addCell(cellMiddle);
   
 
    PdfPTable commanttaire = addProcessCommantaire();
    commanttaire.setWidthPercentage(70f);
   
    cellRight = new PdfPCell(commanttaire);
    cellRight.setBorder(Rectangle.NO_BORDER);
    cellRight.enableBorderSide(Rectangle.RIGHT);
    cellRight.enableBorderSide(Rectangle.LEFT);
View Full Code Here

    addContent(parent);
   
  }
 
  private PdfPTable addtotalsituation(String totalsituation) throws DocumentException{
    PdfPTable processDtoTable = new PdfPTable(5);
    processDtoTable.addCell(new PdfPCell(new Phrase(messageSource.getMessage("FicheST.totalSituation", null, localtion), contentBoldFont)));
    boolean isEmpty = true;
    if(totalsituation != null && totalsituation.length() > 0){
      String[] tmp = totalsituation.split(Constants.SEPRATE);
      if(tmp != null && tmp.length > 3){
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp[0], contentNormalFont)));
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp[1] != null ? tmp[1] : "", contentNormalFont)));
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp[2] != null ? tmp[2] : "", contentNormalFont)));
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp[3] != null ? tmp[3] : "", contentNormalFont)));
      }
    }
    if(isEmpty){
      processDtoTable.addCell(new PdfPCell(new Phrase("", contentNormalFont)));
      processDtoTable.addCell(new PdfPCell(new Phrase("", contentNormalFont)));
      processDtoTable.addCell(new PdfPCell(new Phrase("", contentNormalFont)));
      processDtoTable.addCell(new PdfPCell(new Phrase("", contentNormalFont)));
    }
    float[] wf = {
        25,
        10,
        10,
        10,
        10
      };
    processDtoTable.setWidths(wf);
    return processDtoTable;
  }
View Full Code Here

   
    for (PdfPCell pdfPCell : grid2TableHeader) {
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }
   
    PdfPTable grid2Table = new PdfPTable(3);
    PdfPCell grid2Cell;
   
    addCellsToTable(grid2Table, grid2TableHeader);
    String[] tmp = grid2.split(Constants.SEPRATE);
    String[] messages = {messageSource.getMessage("pdf.process.accomptes.refacturations", null, localtion),
        messageSource.getMessage("pdf.synthese.prorata", null, localtion),
        messageSource.getMessage("FicheST.RefacturationsDontProrata", null, localtion),
        messageSource.getMessage("FicheST.RefacturationsDontProrataEtAutre", null,localtion),
        messageSource.getMessage("pdf.process.titlebox.penalites", null, localtion)};
    for(int i=0; i < tmp.length ; i++){
      switch (i) {
      case 0:
        grid2Cell = new PdfPCell(new Phrase(messages[0], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid2Table.addCell(grid2Cell);
        break;
      case 2:
        grid2Cell = new PdfPCell(new Phrase(messages[1], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid2Table.addCell(grid2Cell);
        break;
      case 4:
        grid2Cell = new PdfPCell(new Phrase(messages[2], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid2Table.addCell(grid2Cell);
        break;
      case 6:
        grid2Cell = new PdfPCell(new Phrase(messages[3], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid2Table.addCell(grid2Cell);
        break;
      case 8:
        grid2Cell = new PdfPCell(new Phrase(messages[4], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid2Table.addCell(grid2Cell);
        break;
      }
      grid2Table.addCell(new PdfPCell(new Phrase(tmp[i], contentBoldFont)));
   
    float[] wf = {
        25,
        10,
        20
      };
    try {
      grid2Table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
      grid2Table.setWidths(wf);
    } catch (DocumentException e) {
      e.printStackTrace();
    }
    return grid2Table;
  }
View Full Code Here

   
    for (PdfPCell pdfPCell : grid3TableHeader) {
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }
   
    PdfPTable grid3Table = new PdfPTable(8);
    PdfPCell grid3Cell;
   
    addCellsToTable(grid3Table, grid3TableHeader);
     
    String[] tmp = grid3.split(Constants.SEPRATE);
   
    String[] messages = {messageSource.getMessage("FicheST.nombre", null, localtion),messageSource.getMessage("FicheST.amount2", null, localtion)};
    for(int i=0; i < tmp.length ; i++){
      switch (i) {
      case 0:
        grid3Cell = new PdfPCell(new Phrase(messages[0], contentBoldFont));
        grid3Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid3Table.addCell(grid3Cell);
        break;
      case 7:
        grid3Cell = new PdfPCell(new Phrase(messages[1], contentBoldFont));
        grid3Cell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
        grid3Table.addCell(grid3Cell);
        break;
      }
      grid3Table.addCell(new PdfPCell(new Phrase(tmp[i], contentNormalFont)));
   
    float[] wf = {
        15,
        10,
        10,
        10,
        10,
        10,10,
        10
      };
    try {
      grid3Table.setWidths(wf);
      grid3Table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    } catch (DocumentException e) {
      e.printStackTrace();
    }
    return grid3Table;
  }
View Full Code Here

    }
    return grid3Table;
  }
 
  private PdfPTable addProcessCommantaire() throws DocumentException{
    PdfPTable commantaireTable = new PdfPTable(1);
    PdfPCell pdfPCell = new PdfPCell(new Phrase(commentaire.equals("null") ? "" : commentaire, contentNormalFont));
    pdfPCell.setBorder(Rectangle.NO_BORDER);
    commantaireTable.addCell(pdfPCell)
    float[] wf = {
        15
      };
    commantaireTable.setWidths(wf);
    commantaireTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    return commantaireTable;
  }
View Full Code Here

  //End
 
  //Add Deduction Report
  private void addDeductionDto() throws DocumentException {

    PdfPTable headerTable = new PdfPTable(1);
    headerTable.setWidthPercentage(100f);
    //Add deduction
    PdfPTable deductionTable = addDeductionTable();
    addContent(deductionTable);
    //Add total deduction
    PdfPTable totalTable = addTotalDeduction();
    addContent(totalTable);
    lineBreak();
   
    PdfPCell leftCell,middleCell,rightCell;
    PdfPTable parent = new PdfPTable(3);
    parent.setSpacingBefore(0f);
    parent.setWidthPercentage(100f);
    float[] wfParent = {
        70//Libellé risque codification
        5,   //Origine de détection
        25
      };
    parent.setWidths(wfParent);

    //Add Penalties
    leftCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.penalites", null, localtion),contentBoldFont));
    leftCell.setBorder(Rectangle.NO_BORDER);
    parent.addCell(leftCell);
   
    middleCell = new PdfPCell();
    middleCell.setBorder(Rectangle.NO_BORDER);
    parent.addCell(middleCell);
   
    rightCell = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.comment", null, localtion),contentBoldFont));
    rightCell.setBorder(Rectangle.NO_BORDER);
    parent.addCell(rightCell);
   
   
    PdfPTable penaltyTable = addPenaltiesTable();
    leftCell = new PdfPCell(penaltyTable);
    parent.addCell(leftCell);
   
    middleCell = new PdfPCell();
    middleCell.setBorder(Rectangle.NO_BORDER);
    parent.addCell(middleCell);
   
    PdfPTable commentairePdfPTable = addDeductionCommantaire();
    rightCell = new PdfPCell(commentairePdfPTable);
    parent.addCell(rightCell);
   
    leftCell = new PdfPCell(addAmountTable());
    parent.addCell(leftCell);
View Full Code Here

    for (PdfPCell pdfPCell : groupTitleCell) {
      pdfPCell.setBorder(Rectangle.NO_BORDER);
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    }

    PdfPTable titleTable = new PdfPTable(1);
    titleTable.setWidthPercentage(100f);
    titleTable.setWidths(wfTitle);
    addCellsToTable(titleTable,groupTitleCell);
    addContent(titleTable);
   
    //Add Group Header
    PdfPCell[] groupHeaderCell = new PdfPCell[3];
    groupHeaderCell[0] = new PdfPCell();
    groupHeaderCell[0].setBorder(Rectangle.NO_BORDER);
    groupHeaderCell[1] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.quante", null, localtion), contentBoldFont));
    groupHeaderCell[1].setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));

    groupHeaderCell[2] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.montant", null, localtion), contentBoldFont));
    groupHeaderCell[2].setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
   
    float[] wfGroupHeader = {
        10,
        70,
        20
      };
    for (PdfPCell pdfPCell : groupHeaderCell) {
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }

    PdfPTable groupHeaderTable = new PdfPTable(3);
    groupHeaderTable.setWidthPercentage(100f);
    groupHeaderTable.setWidths(wfGroupHeader);
    addCellsToTable(groupHeaderTable,groupHeaderCell);
    addContent(groupHeaderTable);
   
   
    //create table header
    String[] arrPrestations = prestations.split(Constants.SEPRATE);
    PdfPCell[] deductionTableHeader = new PdfPCell[10];
    deductionTableHeader[0] = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.date",null,localtion), contentBoldFont));
    deductionTableHeader[1] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.canto",null,localtion) + arrPrestations[0], contentBoldFont));
    deductionTableHeader[2] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.badge",null,localtion) + arrPrestations[1], contentBoldFont));
    deductionTableHeader[3] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.grue",null,localtion) + arrPrestations[2], contentBoldFont))
    deductionTableHeader[4] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.lift",null,localtion) + arrPrestations[3], contentBoldFont));   
    deductionTableHeader[5] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.bene",null,localtion) + arrPrestations[4], contentBoldFont))
    deductionTableHeader[6] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.nettoyage",null,localtion) + arrPrestations[5], contentBoldFont));
    deductionTableHeader[7] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.autres",null,localtion), contentBoldFont));
    deductionTableHeader[8] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.prorata",null,localtion) + arrPrestations[6], contentBoldFont));
    deductionTableHeader[9] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.accomptes.refacturations",null,localtion), contentBoldFont));
   
    for (PdfPCell pdfPCell : deductionTableHeader) {
      pdfPCell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }
    PdfPTable deductionTable = new PdfPTable(10);
   
    //Add Header
    addCellsToTable(deductionTable, deductionTableHeader);
   
    //Add Content
    if(deductions!=null && deductions.length() > 0){
      deductions = deductions.substring(0,deductions.length() - 1);
    }
    String[] tmp = deductions.split(Constants.SEPRATE);
    for(int i=0;i<tmp.length;i++){
      deductionTable.addCell(new PdfPCell(new Phrase(tmp[i], contentNormalFont)));
    }

    float[] wf = {
        10,
        10,
        10,
        10,
        10,
        10,
        10,
        10,
        10,
        10
      };
    deductionTable.setWidthPercentage(100f);
    deductionTable.setWidths(wf);

    return deductionTable;
  }
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.PdfPTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.