Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.LwgPdfPCell


   * Creates a PdfPCell with these attributes.
   * @param rowAttributes
   * @return a PdfPCell based on these attributes.
   */
  public LwgPdfPCell createPdfPCell(SimpleCell rowAttributes) {
    LwgPdfPCell cell = new LwgPdfPCell();
    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 != LwgElement.ALIGN_UNDEFINED)
      cell.setHorizontalAlignment(horizontalAlignment);
    if (verticalAlignment != LwgElement.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);
    LwgElement element;
    for (Iterator i = content.iterator(); i.hasNext(); ) {
      element = (LwgElement)i.next();
      cell.addElement(element);
    }
    return cell;
  }
View Full Code Here


           PdfWriter writer,
           String strWhat,
           Color colForeground,
           Color colBackground) throws Exception
   {
      LwgPdfPCell cell = null;

      float fltRed = ((float) colForeground.getRed()) / 256f;
      float fltGreen = ((float) colForeground.getGreen()) / 256f;
      float fltBlue = ((float) colForeground.getBlue()) / 256f;

      PdfTemplate template = writer.getDirectContent().createTemplate(20, 20);
      BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false);
      String text = strWhat;
      float size = 8;
      float width = bf.getWidthPoint(text, size);
      template.beginText();
      template.setRGBColorFillF(fltRed, fltGreen, fltBlue);
      template.setFontAndSize(bf, size);
      template.setTextMatrix(0, 2);
      template.showText(text);
      template.endText();
      template.setWidth(width);
      template.setHeight(size + 2);

      LwgImage img = LwgImage.getInstance(template);
      img.setRotationDegrees(90);

      cell = new LwgPdfPCell(img);
      cell.setHorizontalAlignment(LwgElement.ALIGN_CENTER);
      cell.setVerticalAlignment(LwgElement.ALIGN_MIDDLE);
      cell.setBackgroundColor(colBackground);


      return cell;
   }
View Full Code Here

      }
      LwgRow row;
        for (Iterator iterator = iterator(); iterator.hasNext(); ) {
            row = (LwgRow) iterator.next();
            LwgElement cell;
            LwgPdfPCell pcell;
            for (int i = 0; i < row.getColumns(); i++) {
                if ((cell = (LwgElement)row.getCell(i)) != null) {
                  if (cell instanceof Table) {
                    pcell = new LwgPdfPCell(((Table)cell).createPdfPTable());
                  }
                  else if (cell instanceof LwgCell) {
                    pcell = ((LwgCell)cell).createPdfPCell();
                    pcell.setPadding(cellpadding + cellspacing / 2f);
                    SimpleCell c_evt = new SimpleCell(SimpleCell.CELL);
                    c_evt.cloneNonPositionParameters((LwgCell)cell);
                    c_evt.setSpacing(cellspacing * 2f);
                        pcell.setCellEvent(c_evt);
                  }
                  else {
                    pcell = new LwgPdfPCell();
                  }
                  pdfptable.add(pcell);
                }
            }
        }
View Full Code Here

          */
        
         this._fltWidthImage_ = img.getWidth();
         this._fltHeightImage_ = img.getHeight();//iin.getIconHeight();
        
         this._cellLogo_ = new LwgPdfPCell(
               img,//force BW
               true// fit to cell
               );
      }
      else
         this._cellLogo_ = new LwgPdfPCell();



   }
View Full Code Here

     
      super.setWidthPercentage(100);
      super.getDefaultCell().setBorderWidth(0);
      super.getDefaultCell().setPadding(5);
     
      LwgPdfPCell cellLogo = new GfrPdfPCell(new LwgPhrase("Sharpergeo - Elk"));
      cellLogo.setFixedHeight(fltHeight);
     
      super.add(cellLogo);

   }
View Full Code Here

    private ArrayList chunks = new ArrayList();
    private LwgPdfPCell cell;
   
    /** Creates a new instance of IncCell */
    public IncCell(String tag, ChainedProperties props) {
        cell = new LwgPdfPCell((LwgPhrase)null);
        String value = props.getProperty("colspan");
        if (value != null)
            cell.setColspan(Integer.parseInt(value));
        value = props.getProperty("align");
        if (tag.equals("th"))
View Full Code Here

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

          new GfrFileOutputStream("com.lowagie.examples.objects.tables.CellPaddingLeading.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(2);
      LwgPdfPCell cell;
      Paragraph p = new Paragraph("Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.");
      table.add("default");
      table.add(p);
      table.add("padding 10");
      cell = new LwgPdfPCell(p);
      cell.setPadding(10f);
      table.add(cell);
      table.add("no padding at all");
      cell = new LwgPdfPCell(p);
      cell.setPadding(0f);
      table.add(cell);
      table.add("no padding at the top; large padding at the left");
      cell = new LwgPdfPCell(p);
      cell.setPaddingTop(0f);
      cell.setPaddingLeft(20f);
      table.add(cell);
      document.add(table);
     
      document.newPage();
      table = new LwgPdfPTable(2);
View Full Code Here

      document3.open();
      // step4
      String text = "Quick brown fox jumps over the lazy dog. ";
      for (int i = 0; i < 5; i++) text += text;
      LwgPdfPTable table = new LwgPdfPTable(2);
      LwgPdfPCell largeCell;
      LwgPhrase phrase;
      for (int i = 0; i < 10; i++) {
        phrase = new LwgPhrase(text);
        for (int j = 0; j < i; j++) {
          phrase.add(new LwgPhrase(text));
        }
        if (i == 7) phrase = new LwgPhrase(text);
        table.add(String.valueOf(i));
        largeCell = new LwgPdfPCell(phrase);
        table.add(largeCell);
      }
      document1.add(table);
      table.setSplitLate(false);
      document2.add(table);
View Full Code Here

          new GfrFileOutputStream("com.lowagie.examples.objects.tables.TableSpacing.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(3);
      LwgPdfPCell cell = new LwgPdfPCell(new Paragraph("header with colspan 3"));
      cell.setColspan(3);
      table.add(cell);
      table.add("1.1");
      table.add("2.1");
      table.add("3.1");
      table.add("1.2");
      table.add("2.2");
      table.add("3.2");
      cell = new LwgPdfPCell(new Paragraph("cell test1"));
      cell.setBorderColor(new Color(255, 0, 0));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("cell test2"));
      cell.setColspan(2);
      cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
      table.add(cell);
      table.setWidthPercentage(50);
      document.add(new Paragraph("We add 2 tables:"));
      document.add(table);
      document.add(table);
View Full Code Here

TOP

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

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.