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

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

Add an Object to this cell.
public Add ( Object o ) : bool
o Object the object to add
Результат bool
        public bool Add(Object o) {
            try {
                this.AddElement((IElement) o);
                return true;
            }
            catch (BadElementException bee) {
                throw new Exception(bee.Message);
            }
            catch {
                throw new Exception("You can only add objects that implement the Element interface.");
            }
        }

Usage Example

Пример #1
0
        //        
        //        public static SimplePersonsList GetInstance(Selection selection,
        //                                                    Rectangle pageSize,
        //                                                    string reportFile) {
        //            
        //            if (instance == null)
        //                instance = new SimplePersonsList(selection, pageSize, reportFile);
        //            else {
        //                instance.selection = selection;
        //                instance.reportFile = reportFile;
        //            }
        //            
        //            if (!this.doc.IsOpen())
        //                this.doc.Open();
        //            
        //            return instance;
        //        }
        public override void MakeReport()
        {
            Table t = new Table(3);
            t.Border = 0;
            t.DefaultCellBorder = 0;

            Cell cell = new Cell();
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            t.DefaultCell = cell; // Default cell

            Font fuenteTitulo = FontFactory.GetFont(FontFactory.HELVETICA_OBLIQUE, 14, Font.UNDERLINE);

            cell = new Cell();
            Chunk texto = new Chunk("Apellido", fuenteTitulo);
            cell.Add(texto);
            t.AddCell(cell);

            cell = new Cell();
            texto = new Chunk("Nombre", fuenteTitulo);
            cell.Add(texto);
            t.AddCell(cell);

            cell = new Cell();
            texto = new Chunk("E-Mail", fuenteTitulo);
            cell.Add(texto);
            t.AddCell(cell);

            Font fuenteDatos = FontFactory.GetFont(FontFactory.HELVETICA, 10);

            foreach (Person p in this.selection.Persons) {
                cell = new Cell();
                texto = new Chunk(p.Surname, fuenteDatos);
                cell.Add(texto);
                t.AddCell(cell);

                cell = new Cell();
                texto = new Chunk(p.Name, fuenteDatos);
                cell.Add(texto);
                t.AddCell(cell);

                cell = new Cell();
                texto = new Chunk(p.EMail, fuenteDatos);
                cell.Add(texto);
                t.AddCell(cell);
            }

            this.doc.Add(t);
        }
All Usage Examples Of iTextSharp.text.Cell::Add