iTextSharp.text.Paragraph.Add C# (CSharp) Метод

Add() публичный Метод

Adds an Object to the Paragraph.
public Add ( IElement o ) : bool
o IElement the object to add
Результат bool
        public override bool Add(IElement o)
        {
            if (o is List) {
                List list = (List) o;
                list.IndentationLeft = list.IndentationLeft + indentationLeft;
                list.IndentationRight = indentationRight;
                base.Add(list);
                return true;
            }
            else if (o is Image) {
                base.AddSpecial((Image) o);
                return true;
            }
            else if (o is Paragraph) {
                base.Add(o);
                IList<Chunk> chunks = this.Chunks;
                if (chunks.Count > 0) {
                    Chunk tmp = chunks[chunks.Count - 1];
                    base.Add(new Chunk("\n", tmp.Font));
                }
                else {
                    base.Add(Chunk.NEWLINE);
                }
                return true;
            }
            base.Add(o);
            return true;
        }

Usage Example

        public static IElement GetElement(this HeaderBase hb)
        {
            Paragraph p = new Paragraph();

            Font f = TextSharpFonts.SectionHeaderFont;

            if (hb is TitleHeader)
            {
                f = TextSharpFonts.TitleHeaderFont;
                p.Add(new Phrase(hb.Header, f));
                p.Alignment = Element.ALIGN_CENTER;
                p.Leading = f.Size * 2f;
                p.SpacingAfter = f.Size * 1.5f;
            }

            if (hb is SectionHeader)
            {
                p.Add(new Phrase(hb.Header, f));
                p.Leading = f.Size * 1.5f;
            }

            if (hb is ItemHeader)
            {
                p.Add(new Phrase(hb.Header, TextSharpFonts.ItemHeaderFont));
            }

            return p;
        }
All Usage Examples Of iTextSharp.text.Paragraph::Add