Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfPCell


   * Creates a PdfPCell with these attributes.
   * @param rowAttributes
   * @return a PdfPCell based on these attributes.
   */
  public PdfPCell createPdfPCell(SimpleCell rowAttributes) {
    PdfPCell cell = new PdfPCell();
    cell.setBorder(NO_BORDER);
    SimpleCell tmp = new SimpleCell(CELL);
    tmp.setSpacing_left(spacing_left);
    tmp.setSpacing_right(spacing_right);
    tmp.setSpacing_top(spacing_top);
    tmp.setSpacing_bottom(spacing_bottom);
    tmp.cloneNonPositionParameters(rowAttributes);
    tmp.softCloneNonPositionParameters(this);
    cell.setCellEvent(tmp);
    cell.setHorizontalAlignment(rowAttributes.horizontalAlignment);
    cell.setVerticalAlignment(rowAttributes.verticalAlignment);
    cell.setUseAscender(rowAttributes.useAscender);
    cell.setUseBorderPadding(rowAttributes.useBorderPadding);
    cell.setUseDescender(rowAttributes.useDescender);
    cell.setColspan(colspan);
    if (horizontalAlignment != Element.ALIGN_UNDEFINED)
      cell.setHorizontalAlignment(horizontalAlignment);
    if (verticalAlignment != Element.ALIGN_UNDEFINED)
      cell.setVerticalAlignment(verticalAlignment);
    if (useAscender)
      cell.setUseAscender(useAscender);
    if (useBorderPadding)
      cell.setUseBorderPadding(useBorderPadding);
    if (useDescender)
      cell.setUseDescender(useDescender);
    float p;
    float sp_left = spacing_left;
    if (Float.isNaN(sp_left)) sp_left = 0f;
    float sp_right = spacing_right;
    if (Float.isNaN(sp_right)) sp_right = 0f;
    float sp_top = spacing_top;
    if (Float.isNaN(sp_top)) sp_top = 0f;
    float sp_bottom = spacing_bottom;
    if (Float.isNaN(sp_bottom)) sp_bottom = 0f;
    p = padding_left;
    if (Float.isNaN(p)) p = 0f;
    cell.setPaddingLeft(p + sp_left);
    p = padding_right;
    if (Float.isNaN(p)) p = 0f;
    cell.setPaddingRight(p + sp_right);
    p = padding_top;
    if (Float.isNaN(p)) p = 0f;
    cell.setPaddingTop(p + sp_top);
    p = padding_bottom;
    if (Float.isNaN(p)) p = 0f;
    cell.setPaddingBottom(p + sp_bottom);
    Element element;
    for (Iterator i = content.iterator(); i.hasNext(); ) {
      element = (Element)i.next();
      cell.addElement(element);
    }
    return cell;
  }
View Full Code Here


      }
      Row row;
        for (Iterator iterator = iterator(); iterator.hasNext(); ) {
            row = (Row) iterator.next();
            Element cell;
            PdfPCell pcell;
            for (int i = 0; i < row.getColumns(); i++) {
                if ((cell = (Element)row.getCell(i)) != null) {
                  if (cell instanceof Table) {
                    pcell = new PdfPCell(((Table)cell).createPdfPTable());
                  }
                  else if (cell instanceof Cell) {
                    pcell = ((Cell)cell).createPdfPCell();
                     pcell.setPadding(cellpadding + cellspacing / 2f);
                         pcell.setCellEvent(SimpleCell.getDimensionlessInstance((Cell)cell, cellspacing));
                  }
                  else {
                    pcell = new PdfPCell();
                  }
                  pdfptable.addCell(pcell);
                }
            }
        }
View Full Code Here

    .setAction(new PdfAction(PdfAction.FIRSTPAGE))));
  return header; 
  }
*/
  static PdfPCell borderlessCell(String s){
      PdfPCell cell = new PdfPCell();
      Font f = new Font(Font.COURIER);
      cell.setBorder(0);
      cell.setHorizontalAlignment(Element.ALIGN_LEFT);
      cell.addElement(new Paragraph(s,f));
      return cell;
  }
View Full Code Here

       PdfPTable headerTable= new PdfPTable(2);
          Image ii = Image.getInstance("c:/smi-logo.gif");
          ii.setAlignment(Element.ALIGN_RIGHT);
          ii.scalePercent(25);
      
          PdfPCell cell1 = new PdfPCell(ii,false);
          cell1.setBorder(0);
         
          headerTable.addCell(cell1);
      
       //   cell = borderlessCell("Code of Doom Order Form");
         

       

Date now = new Date();
System.out.println("date--> " + now);
DateFormat df = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");
String s1 = df.format(now);
         
Chunk CONNECT = new Chunk(new LineSeparator(5.5f, 95, Color.BLUE, Element.ALIGN_CENTER, 3.5f));
  //  LineSeparator UNDERLINE =new LineSeparator(1, 100, null, Element.ALIGN_CENTER, -2);

//public HeaderFooter getMyHeader(String titulo) throws ServletException { 
//    Phrase p= new Phrase(); 
//    Chunk chunkTemp = new Chunk("My Company Name\n", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL); 
//    p.add(chunkTemp); 
//    chunkTemp = new Chunk("_____________________________________________________________________________________________________", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL); 
//    p.add(chunkTemp); 
//    HeaderFooter header = new HeaderFooter(p, false); 
//    return header; 



          headerTable.addCell(main.borderlessCell(s1));
      
//          headerTable.addCell(borderlessCell("Customer Name"));
//          headerTable.addCell(borderlessCell(c.getName()));
//          headerTable.addCell(borderlessCell("Address"));
//          headerTable.addCell(borderlessCell(c.getAddress()));
//          headerTable.addCell(borderlessCell("Phone Number"));
//          headerTable.addCell(borderlessCell(c.getPhone()));
          doc.add(headerTable);
//              Phrase phrase = new Phrase(50);
//              doc.add(phrase);
          Paragraph paragraph = new Paragraph( "");
          main.addEmptyLine(paragraph,10);
         paragraph.add(CONNECT);
          doc.add( paragraph )
         
//          Chunk c = new Chunk( text, font );
//          c.setAction( new PdfAction( new URL( url ) ) );
//          c.setUnderline(0.8f, -0.8f);
//          doc.add( c );
         
         
         
         
          PdfPTable tab=new PdfPTable(6);
        PdfPCell cell = new PdfPCell(new Paragraph("Process Details"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBackgroundColor(new Color(20,105,160));
        cell.setColspan(6);
        tab.addCell(cell);
        tab.addCell("id");
        tab.addCell("pid");
        tab.addCell("mid");
        tab.addCell("processname");
View Full Code Here

            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,
View Full Code Here

  /**
   * Obtenerme
   * Obtiene una instancia de la Celda con los datos que se fueron agregando
   */
  public PdfPCell getMe(){
    PdfPCell cell = getCell();
   
    cell.setBackgroundColor(color);
    cell.setHorizontalAlignment(alineacionHorizontal);
    cell.setVerticalAlignment(alineacionVertical);
    cell.setColspan(colspan);
    //cell.setNoWrap(Boolean.TRUE);
    if (border!=null){
      cell.setBorder(border);
    }
    return cell;
  }
View Full Code Here

  }

  private PdfPCell getCell() {
    Phrase phrase = new Phrase(buffer.toString());
    phrase.getFont().setSize(7);
    PdfPCell cell = null;
    if (element==null){
      cell = new PdfPCell(phrase);
    } else {
      if (element instanceof Image) {
        cell = new PdfPCell((Image)element);
      }
      if (element instanceof PdfPTable) {
        cell = new PdfPCell((PdfPTable)element);
      }
    }
    return cell;
 
View Full Code Here

        PdfPCell[] cells = row.getCells();
        for(int i = 0; i < cells.length; i++) {
            cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100);
            cellRight = cellRight + cellWidth;
           
            PdfPCell cell = cells[i];
            PatchRtfCell rtfCell = new PatchRtfCell(this.document, this, cell);
            rtfCell.setCellRight(cellRight);
            rtfCell.setCellWidth(cellWidth);
            this.cells.add(rtfCell);
        }
View Full Code Here

            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,
View Full Code Here

            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

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.