Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfPCell


  }
 
  private PdfPTable addDeductionCommantaire(){
    //create table header
    PdfPCell[] commantaireTableHeader = new PdfPCell[1];
    commantaireTableHeader[0] = new PdfPCell(new Phrase("Commentaires / Informations : ", contentBoldFont));
   

    for (PdfPCell pdfPCell : commantaireTableHeader) {
      pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    }
 
    PdfPTable commantaireTable = new PdfPTable(1);
   
    //addCellsToTable(commantaireTable, commantaireTableHeader);
    PdfPCell pdfPCell = new PdfPCell(new Phrase(commentaire + "\n" + internalCommentaire, contentNormalFont));
    pdfPCell.setBorder(Rectangle.NO_BORDER);
    commantaireTable.addCell(pdfPCell)
    float[] wf = {
        15
      };
    try {
View Full Code Here


   
  }
 
  private PdfPTable addtotalsituation(String totalsituation){
    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], contentNormalFont)));
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp[2], contentNormalFont)));
        processDtoTable.addCell(new PdfPCell(new Phrase(tmp[3], contentNormalFont)));
        isEmpty = false;
      }
    }
    if(isEmpty){
      processDtoTable.addCell(new PdfPCell(new Phrase("0", contentNormalFont)));
      processDtoTable.addCell(new PdfPCell(new Phrase("0", contentNormalFont)));
      processDtoTable.addCell(new PdfPCell(new Phrase("0", contentNormalFont)));
      processDtoTable.addCell(new PdfPCell(new Phrase("0", contentNormalFont)));
    }

    float[] wf = {
        25,
        10,
View Full Code Here

 
  private PdfPTable addGrid2(String grid2) throws DocumentException{
    //create table header
    PdfPCell[] grid2TableHeader = new PdfPCell[3];
   
    grid2TableHeader[0] = new PdfPCell(new Phrase("", contentBoldFont));

    grid2TableHeader[1] = new PdfPCell(new Phrase("Montant", contentBoldFont));
    grid2TableHeader[1].setBackgroundColor(new Color(181,181,181));

    grid2TableHeader[2] = new PdfPCell(new Phrase("Pourcentage du régularisé", contentBoldFont));
    grid2TableHeader[2].setBackgroundColor(new Color(181,181,181));
   
    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("FicheST.Refacturations", null, localtion) ,messageSource.getMessage("FicheST.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(181,181,181));
        grid2Table.addCell(grid2Cell);
        break;
      case 2:
        grid2Cell = new PdfPCell(new Phrase(messages[1], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(181,181,181));
        grid2Table.addCell(grid2Cell);
        break;
      case 4:
        grid2Cell = new PdfPCell(new Phrase(messages[2], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(181,181,181));
        grid2Table.addCell(grid2Cell);
        break;
      case 6:
        grid2Cell = new PdfPCell(new Phrase(messages[3], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(181,181,181));
        grid2Table.addCell(grid2Cell);
        break;
      case 8:
        grid2Cell = new PdfPCell(new Phrase(messages[4], contentBoldFont));
        grid2Cell.setBackgroundColor(new Color(181,181,181));
        grid2Table.addCell(grid2Cell);
        break;
      }
      grid2Table.addCell(new PdfPCell(new Phrase(tmp[i], contentBoldFont)));
   
    float[] wf = {
        25,
        10,
        20
View Full Code Here

 
  private PdfPTable addGrid3(String grid3) throws DocumentException{
    //create table header
    PdfPCell[] grid3TableHeader = new PdfPCell[8];
      
    grid3TableHeader[0] = new PdfPCell(new Phrase("", contentBoldFont));

    grid3TableHeader[1] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.canto",null, localtion), contentBoldFont));
    grid3TableHeader[1].setBackgroundColor(new Color(181,181,181));
   
    grid3TableHeader[2] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.badge",null, localtion), contentBoldFont));
    grid3TableHeader[2].setBackgroundColor(new Color(181,181,181));

    grid3TableHeader[3] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.grue",null, localtion), contentBoldFont));
    grid3TableHeader[3].setBackgroundColor(new Color(181,181,181));
   
    grid3TableHeader[4] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.lift",null, localtion), contentBoldFont));
    grid3TableHeader[4].setBackgroundColor(new Color(181,181,181));
   
    grid3TableHeader[5] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.benne",null, localtion), contentBoldFont));
    grid3TableHeader[5].setBackgroundColor(new Color(181,181,181));
   
    grid3TableHeader[6] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.netoyage",null, localtion), contentBoldFont));
    grid3TableHeader[6].setBackgroundColor(new Color(181,181,181));
   
    grid3TableHeader[7] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.synthese.autres",null, localtion), contentBoldFont));
    grid3TableHeader[7].setBackgroundColor(new Color(181,181,181));
   
   
    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 = {"Nombre","Montant"};
    for(int i=0; i < tmp.length ; i++){
      switch (i) {
      case 0:
        grid3Cell = new PdfPCell(new Phrase(messages[0], contentBoldFont));
        grid3Cell.setBackgroundColor(new Color(181,181,181));
        grid3Table.addCell(grid3Cell);
        break;
      case 7:
        grid3Cell = new PdfPCell(new Phrase(messages[1], contentBoldFont));
        grid3Cell.setBackgroundColor(new Color(181,181,181));
        grid3Table.addCell(grid3Cell);
        break;
      }
      grid3Table.addCell(new PdfPCell(new Phrase(tmp[i], contentNormalFont)));
   
    float[] wf = {
        15,
        10,
        10,
View Full Code Here

  }
 
  private PdfPTable addProcessCommantaire() throws DocumentException{
    //create table header
    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);
View Full Code Here

    PdfPTable table = new PdfPTable(colNumber);
    table.setWidths(widths);
    table.setWidthPercentage(98.3f);

    PdfPCell headerCell = new PdfPCell(header);
    headerCell.setColspan(colNumber);
    headerCell.setBackgroundColor(HEADER_COLOR);
    table.addCell(headerCell);

    //BaseFont font = BaseFont.createFont("Helvetica", "winansi", false);
    for (int lineIndex = startLine; lineIndex < endLine; lineIndex++) {
      for (int colIndex = startColumn; colIndex < endColumn; colIndex++) {

        PdfPCell cell = new PdfPCell(matrix[lineIndex][colIndex]);
        cell.setFixedHeight(80f);
        cell.setLeading(50f, 0f);
        cell.setHorizontalAlignment(DEFAULT_HORZ_ALIGN);
        cell.setVerticalAlignment(DEFAULT_VERT_ALIGN);

        table.addCell(cell);
      }
    }
View Full Code Here

        PdfPTable mapInfo = new PdfPTable(1);
        {
            mapInfo.getDefaultCell().setBorderWidth(0);

            Paragraph header = new Paragraph("Información resultado\n\n", new Font(Font.HELVETICA, 14, Font.BOLDITALIC));
            PdfPCell cell = new PdfPCell(header);
            cell.setColspan(1);
            cell.setBorderWidth(0);
            mapInfo.addCell(cell);

            PdfPTable subTable = new PdfPTable(1);
            subTable.getDefaultCell().setBorderWidth(0);

            Paragraph p = new Paragraph();
            Font f = new Font(Font.COURIER, 12);

            Iterator iterator = params.keySet().iterator();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                String name = key + ":";
                while (name.length() < 23) {
                    name += " ";
                }
                p.add(new Chunk(" " + name + params.get(key) + "\n", f));
            }

            subTable.addCell(p);
            mapInfo.addCell(subTable);
            mapInfo.setWidthPercentage(100);
            document.add(mapInfo);
        }

        //add system information
        PdfPTable systemInfo = new PdfPTable(1);
        {
            systemInfo.getDefaultCell().setBorderWidth(0);

            Paragraph header = new Paragraph("\n\nInformación Sistema\n\n", new Font(Font.HELVETICA, 14, Font.BOLDITALIC));
            PdfPCell cell = new PdfPCell(header);
            cell.setColspan(1);
            cell.setBorderWidth(0);
            systemInfo.addCell(cell);

            PdfPTable subTable = new PdfPTable(1);
            subTable.getDefaultCell().setBorderWidth(0);

            Paragraph p = new Paragraph();
            Font f = new Font(Font.COURIER, 12);

            Iterator iterator = systemProperties.keySet().iterator();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                String name = key + ":";
                while (name.length() < 23) {
                    name += " ";
                }
                p.add(new Chunk(" " + name + systemProperties.get(key) + "\n", f));
            }

            subTable.addCell(p);
            systemInfo.addCell(subTable);
            systemInfo.setWidthPercentage(100);
            document.add(systemInfo);
        }

        document.setMargins(40, 40, 30, 30);
        document.setPageSize(PageSize.A4.rotate());
        document.newPage();

        if (image != null) {
            Image img = Image.getInstance(image, null);
            img.setAlignment(Element.ALIGN_CENTER);
            document.add(img);
        }


        document.setMargins(40,40,170,60);
        document.setPageSize(PageSize.A4);
        document.newPage();

        //list table with the path through the cities and distances between them
        document.add(new Paragraph("Rutas del Problema\n\n",new Font(Font.HELVETICA, 14, Font.BOLDITALIC)));

        //create font for header and cities.
        //TODO: how to create unicode font without having to transfer .ttf file ?
        Font tableHeaderFont=new Font(BaseFont.createFont(
              BaseFont.HELVETICA,
              BaseFont.CP1250,
              BaseFont.EMBEDDED),
              12, Font.BOLD);

        //create tabe and set properties
        PdfPTable datatable = new PdfPTable(6);
        int headerwidths[] = { 5, 31, 16, 16, 16, 16}; // percentage
        datatable.setWidths(headerwidths);
        datatable.setWidthPercentage(100); // percentage
        datatable.getDefaultCell().setPadding(2);
        datatable.getDefaultCell().setBorderWidth(1);
        datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

        //header row
        PdfPCell c1=new PdfPCell(new Phrase("Barrio",tableHeaderFont));
        c1.setColspan(2);
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setVerticalAlignment(Element.ALIGN_CENTER);

        datatable.addCell(c1);
        datatable.addCell(new Phrase("X\n",tableHeaderFont));
        datatable.addCell(new Phrase("Y\n",tableHeaderFont));
        datatable.addCell(new Phrase("Distancia\n[m]",tableHeaderFont));
View Full Code Here

            p.add(new Chunk("\n\n" + parameters.get(PARAM_COMPUTATION_TIME) + "\n", new Font(Font.HELVETICA, 11, Font.NORMAL)));

            table.getDefaultCell().setBackgroundColor(Color.WHITE);
            table.getDefaultCell().setBorderWidth(0);

            PdfPCell cell = new PdfPCell(p);
            cell.setPadding(20);
            cell.setBorderWidth(0);
            table.addCell(cell);

            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(new Phrase(new Chunk(headerImage, 0, 0)));
View Full Code Here

      PdfPTable tab = new PdfPTable(table.getColumnCount());

      tab.setWidthPercentage(100);

      for (int i = 0; i < table.getColumnCount(); i++) {
        PdfPCell cell = new PdfPCell(new Paragraph(
            table.getColumnName(i), f1));
        tab.addCell(cell);

      }
      Font f2 = new Font(bf, 8);
      for (int i = 0; i < count; i++) {
        for (int j = 0; j < table.getColumnCount(); j++) {
          Object obj1 = GetData(table, i, j);
          String value1 = obj1.toString();
          PdfPCell cell = new PdfPCell(new Paragraph(value1, f2));
          tab.addCell(cell);
        }
      }
      document.add(tab);
View Full Code Here

    public void addCells() {
        if (descriptionInNewLine != null && descriptionInNewLine) {
            addCell(description);
            addCell(getCell());
            addCell(content);
            PdfPCell dummyCell = getCell();
            dummyCell.addElement(new ITextParagraph(" "));
            addCell(dummyCell);
        } else {
            addCell(description);
            addCell(content);
        }
View Full Code Here

TOP

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

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.