Esempio n. 1
0
        /**
         * Creates a PdfPCell based on this Cell object.
         * @return a PdfPCell
         * @throws BadElementException
         */
        public PdfPCell CreatePdfPCell()
        {
            if (rowspan > 1)
            {
                throw new BadElementException("PdfPCells can't have a rowspan > 1");
            }
            if (IsTable())
            {
                return(new PdfPCell(((Table)arrayList[0]).CreatePdfPTable()));
            }
            PdfPCell cell = new PdfPCell();

            cell.VerticalAlignment   = verticalAlignment;
            cell.HorizontalAlignment = horizontalAlignment;
            cell.Colspan             = colspan;
            cell.UseBorderPadding    = useBorderPadding;
            cell.UseDescender        = useDescender;
            cell.SetLeading(Leading, 0);
            cell.CloneNonPositionParameters(this);
            cell.NoWrap = noWrap;
            foreach (IElement i in Elements)
            {
                if (i.Type == Element.PHRASE || i.Type == Element.PARAGRAPH)
                {
                    Paragraph p = new Paragraph((Phrase)i);
                    p.Alignment = horizontalAlignment;
                    cell.AddElement(p);
                }
                else
                {
                    cell.AddElement(i);
                }
            }
            return(cell);
        }