Exemplo n.º 1
0
 protected void ToDomString(DomElementList elements, StringBuilder stringBuilder, int level)
 {
     foreach (DomElement element in elements)
     {
         stringBuilder.Append(Environment.NewLine);
         stringBuilder.Append(new string(' ', level * 4));
         stringBuilder.Append(element);
         ToDomString(element.Elements, stringBuilder, level + 1);
     }
 }
Exemplo n.º 2
0
 protected DomElement()
 {
     Elements   = new DomElementList();
     Attributes = new AttributeList();
 }
Exemplo n.º 3
0
 protected DomElement()
 {
     Elements = new DomElementList();
     Attributes = new AttributeList();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Fixes invalid paragraphs
        /// </summary>
        // ReSharper disable UnusedMember.Global
        public void FixForParagraphs(DomElement parentElement)
        // ReSharper restore UnusedMember.Global
        {
            DomParagraph lastParagraph = null;
            var list = new DomElementList();
            foreach (DomElement element in parentElement.Elements)
            {
                if (element is DomHeader
                    || element is DomFooter)
                {
                    FixForParagraphs(element);
                    lastParagraph = null;
                    list.Add(element);
                    continue;
                }

                if (element is DomParagraph
                    || element is DomTableRow
                    || element is DomTable
                    || element is DomTableCell)
                {
                    lastParagraph = null;
                    list.Add(element);
                    continue;
                }

                if (lastParagraph == null)
                {
                    lastParagraph = new DomParagraph();
                    list.Add(lastParagraph);
                    if (element is DomText)
                        lastParagraph.Format = ((DomText) element).Format.Clone();
                }

                lastParagraph.Elements.Add(element);
            }

            parentElement.Elements.Clear();
            
            foreach (DomElement element in list)
                parentElement.Elements.Add(element);
        }
Exemplo n.º 5
0
 protected void ToDomString(DomElementList elements, StringBuilder stringBuilder, int level)
 {
     foreach (DomElement element in elements)
     {
         stringBuilder.Append(Environment.NewLine);
         stringBuilder.Append(new string(' ', level*4));
         stringBuilder.Append(element);
         ToDomString(element.Elements, stringBuilder, level + 1);
     }
 }