Esempio n. 1
0
        /// <summary>
        /// Render the given Paragraph tag to the PDF document.
        /// </summary>
        /// <param name="paragraph">Paragraph tag to be rendered.</param>
        /// <param name="renderer">PDF renderer to use for rendering the tag.</param>
        protected override void Render(Section section, PdfBuilder renderer)
        {
            // If the section contains no content (child tags), then don't
            // bother writing the heading.
            if (!section.IsEmpty())
            {
                // Add a heading at the current heading level.
                if (!string.IsNullOrEmpty(section.Title))
                {
                    renderer.AppendHeading(section.Title);
                }

                // Increment the heading level, so that any child tags' headings
                // are written as subheadings.
                renderer.PushSubHeading();

                // Add child tags.
                foreach (ITag child in section.Children)
                {
                    renderer.Write(child);
                }

                renderer.PopSubHeading();
            }
        }
Esempio n. 2
0
        public void TestSimpleHeading()
        {
            builder.AppendHeading("hello");
            Assert.AreEqual(1, doc.Sections.Count);
            Assert.AreEqual(1, doc.LastSection.Elements.Count);

            Paragraph paragraph = doc.LastSection.Elements.LastObject as Paragraph;

            ValidateHeading(paragraph, "1 ", "hello");
        }