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

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

Adds a Paragraph, List or Table to this Section.
public Add ( int index, Object o ) : void
index int index at which the specified element is to be inserted
o Object an object of type Paragraph, List or Table
Результат void
        public void Add(int index, Object o) {
            if (AddedCompletely) {
                throw new InvalidOperationException("This LargeElement has already been added to the Document.");
            }
            try {
                IElement element = (IElement) o;
                if (element.IsNestable()) {
                    base.Insert(index, element);
                }
                else {
                    throw new Exception(element.Type.ToString());
                }
            }
            catch (Exception cce) {
                throw new Exception("Insertion of illegal Element: " + cce.Message);
            }
        }
    

Same methods

Section::Add ( Object o ) : bool

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