Package com.lowagie.text

Examples of com.lowagie.text.Cell


    return theCell;
  }

  public Cell toPDF() {
    Cell aCell = new Cell();
    String aFontName = FontFactory.HELVETICA;//TODO make configurable
    int aFontSize = 12;
    int aFontFace = Font.NORMAL;
    // align
    if (itsAlign == ALIGN_LEFT || itsAlign == ALIGN_NONE ) {
      aCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    } else if (itsAlign == ALIGN_CENTER) {
      aCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    } else if (itsAlign == ALIGN_RIGHT) {
      aCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    } else {
      //TODO warning?
    }
    if (isHeader) {
//todo set bottom line
      aFontFace = Font.BOLD;
    }
   
    if (itsBold) {
      if (itsItalic) {
        aFontFace = Font.BOLDITALIC;
      } else {
        aFontFace = Font.BOLD;
      }
    } else if (itsItalic) {
      aFontFace = Font.ITALIC;
    } else if (itsUnderline) {
      aFontFace = Font.UNDERLINE;
    } else if (itsStrikethru) {
      aFontFace = Font.STRIKETHRU;
    }
   
    //TODO black and white option?
    Chunk aChunk = null;
    if (itsURL != null && itsURLinPDF) {
      try {
        aChunk = new Chunk(itsValue, FontFactory.getFont(aFontName, aFontSize, Font.UNDERLINE, getColor("blue")));
        aChunk.setAnchor(new URL("http://www.lowagie.com/iText/"));
      } catch (MalformedURLException e) {
        //TODO
      }
    } else {
      if (itsForegroundColor != null) {
        aChunk = new Chunk(itsValue, FontFactory.getFont(aFontName, aFontSize, aFontFace, getColor(itsForegroundColor)));
      } else {
        aChunk = new Chunk(itsValue, FontFactory.getFont(aFontName, aFontSize, aFontFace));
      }
    }
    if (itsBackgroundColor != null) {
      //TODO
    }
    aCell.add(aChunk);
   
    return aCell;
  }
View Full Code Here


            if (columnHeader == null)
            {
                columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName());
            }

            Cell hdrCell = getCell(columnHeader);
            hdrCell.setGrayFill(0.9f);
            hdrCell.setHeader(true);
            tablePDF.addCell(hdrCell);

        }
    }
View Full Code Here

                Column column = columnIterator.nextColumn();

                // Get the value to be displayed for the column
                Object value = column.getValue(this.decorated);

                Cell cell = getCell(ObjectUtils.toString(value));
                tablePDF.addCell(cell);
            }
        }
    }
View Full Code Here

     * @return Cell
     * @throws BadElementException errors while generating content
     */
    private Cell getCell(String value) throws BadElementException
    {
        Cell cell = new Cell(new Chunk(StringUtils.trimToEmpty(value), smallFont));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setLeading(8);
        return cell;
    }
View Full Code Here

            if (columnHeader == null)
            {
                columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName());
            }

            Cell hdrCell = this.getHeaderCell(columnHeader);
            this.table.addCell(hdrCell);
        }
        this.table.setWidths(widths);
        this.table.endHeaders();
    }
View Full Code Here

     */
    protected void writePostBodyFooter(TableModel model) throws DocumentException
    {
        Chunk cellContent = new Chunk(model.getFooter(), this.getFooterFont());
        this.setFooterFontStyle(cellContent);
        Cell cell = new Cell(cellContent);
        cell.setLeading(8);
        cell.setBackgroundColor(this.getFooterBackgroundColor());
        cell.setHorizontalAlignment(this.getFooterHorizontalAlignment());
        cell.setColspan(model.getNumberOfColumns());
        table.addCell(cell);
    }
View Full Code Here

     * @return Cell
     * @throws BadElementException if errors occurs while generating content.
     */
    private Cell getCell(Object value) throws BadElementException
    {
        Cell cell = new Cell(new Chunk(StringUtils.trimToEmpty(ObjectUtils.toString(value)), this.defaultFont));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setLeading(8);
        return cell;
    }
View Full Code Here

     */
    private Cell getHeaderCell(String value) throws BadElementException
    {
        Chunk cellContent = new Chunk(value, this.getHeaderFont());
        setHeaderFontStyle(cellContent);
        Cell cell = new Cell(cellContent);
        cell.setLeading(8);
        cell.setHeader(true);
        cell.setHorizontalAlignment(this.getHeaderHorizontalAlignment());
        cell.setBackgroundColor(this.getHeaderBackgroundColor());
        return cell;
    }
View Full Code Here

        for(int i = 0; i < images.size(); i++)
        {
          Image png = (Image)images.get(i);
          if(HORIZONTAL_ORIENTATION.equalsIgnoreCase(orientation))
          {
            Cell pngCell = new Cell(png);
            pngCell.setBorder(0);
            table.setBorder(0);
            table.addCell(pngCell);
          } else
          {
            png.setAlignment(5);
View Full Code Here

            if (columnHeader == null)
            {
                columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName());
            }

            Cell hdrCell = getCell(columnHeader);
            hdrCell.setGrayFill(0.9f);
            hdrCell.setHeader(true);
            tablePDF.addCell(hdrCell);

        }
    }
View Full Code Here

TOP

Related Classes of com.lowagie.text.Cell

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.