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

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

Adds a Paragraph, List, Table or another Section to this Section.
public Add ( Object o ) : bool
o Object an object of type Paragraph, List, Table or another Section
Результат bool
        public new bool Add(Object o) {
            try {
                IElement element = (IElement) o;
                if (element.Type == Element.SECTION) {
                    Section section = (Section) o;
                    section.SetNumbers(++subsections, numbers);
                    base.Add(section);
                    return true;
                }
                else if (o is MarkedSection && ((MarkedObject)o).element.Type == Element.SECTION) {
                    MarkedSection mo = (MarkedSection)o;
                    Section section = (Section)(mo.element);
                    section.SetNumbers(++subsections, numbers);
                    base.Add(mo);
                    return true;
                }
                else if (element.IsNestable()) {
                    base.Add(o);
                    return true;
                }
                else {
                    throw new Exception(element.Type.ToString());
                }
            }
            catch (Exception cce) {
                throw new Exception("Insertion of illegal Element: " + cce.Message);
            }
        }
    

Same methods

Section::Add ( int index, Object o ) : void

Usage Example

Пример #1
0
        public bool CreatePdf()
        {
            bool result = true;

            try
            {
                if (calendarEvent == null)
                {
                    result = false;
                }
                else
                {
                    PdfDocument.Open();
                    Chapter chapter = AddChapter(new Paragraph(GetTitleText("Záznam o návšteve"))
                    {
                        SpacingAfter = 10f, Alignment = HAlingmentLeft
                    }, 0, 0);
                    iTextSharp.text.Section firstSection = AddSection(chapter, 0f,
                                                                      new Paragraph(GetSectionText(calendarEvent.Patient.FullName + " " + calendarEvent.StartDate.ToString("d. MMMM yyyy, HH:mm")))
                                                                      , 0);

                    firstSection.Add(CreateInfoTable());

                    iTextSharp.text.Section actionsSection = AddSection(chapter, 0f, new Paragraph(GetSectionText("Vykonané")), 0);
                    if (!string.IsNullOrEmpty(calendarEvent.ExecutedActionText))
                    {
                        actionsSection.Add(new Paragraph(GetText(calendarEvent.ExecutedActionText)));
                    }
                    actionsSection.Add(CreateActionsTable());

                    iTextSharp.text.Section billingSection = AddSection(chapter, 0f, new Paragraph(GetSectionText("Vyúčtovanie")), 0);
                    EventBill eventBill = calendarEvent.EventBills.FirstOrDefault();
                    if (eventBill != null && eventBill.EventBillItems.Count != 0)
                    {
                        billingSection.Add(CreateBillingTable(eventBill));
                    }
                    else
                    {
                        billingSection.Add(new Paragraph(GetBoldText("Návšteva neobsahuje žiadne účtovné položky")));
                    }

                    PdfDocument.Add(chapter);

                    AddFooter();

                    PdfDocument.Close();
                }
            }
            catch (Exception ex)
            {
                BasicMessagesHandler.LogException(ex);
                result = false;
            }

            return(result);
        }
All Usage Examples Of iTextSharp.text.Section::Add