/// <summary>
        /// Renders the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void Render(TextWriter writer)
        {
            if (RenderMode != TagRenderMode.SelfClosing)
            {
                writer.Write(tagBuilder.ToString(TagRenderMode.StartTag));

                if (Template != null)
                {
                    Template(writer);
                }
                if (ChildElements.Any())
                {
                    ChildElements.ForEach(child => child.Render(writer));
                }
                else
                {
                    writer.Write(tagBuilder.InnerHtml);
                }

                writer.Write(tagBuilder.ToString(TagRenderMode.EndTag));
            }
            else
            {
                writer.Write(tagBuilder.ToString(TagRenderMode.SelfClosing));
            }
        }
Example #2
0
 protected internal override void RenderNode(WordTemplateParameters p)
 {
     if (this.NodeProvider.IsParagraph(this.Parent) &&
         !this.Parent !.ChildElements.Any(a => BlockContainerNode.IsImportant(a, NodeProvider) && a != this))
     {
         this.Parent.Remove();
     }
        public XmlNode ToNode(XmlDocument doc)
        {
            var node = doc.CreateElement(RootElementName);

            var idAtr = doc.CreateAttribute("id");
            idAtr.Value = Id;
            node.Attributes.Append(idAtr);

            if (!string.IsNullOrEmpty(Title))
            {
                var atr = doc.CreateAttribute("title");
                atr.Value = Title;
                node.Attributes.Append(atr);
            }

            if (!string.IsNullOrEmpty(Image))
            {
                var atr = doc.CreateAttribute("image");
                atr.Value = Image.Contains("Template") ? Image : $"base64:{Image}";

                node.Attributes.Append(atr);
            }

            if (ChildElements.Any())
                node.AppendChild(CreateIdentifiedChildNode(doc, ChildElements, ChildElementName, "PopoverChild"));

            if (PressAndHoldChildElements.Any())
                node.AppendChild(CreateIdentifiedChildNode(doc, PressAndHoldChildElements, PressAndHoldChildElementName, "PressAndHoldChild"));

            return node;
        }
        public bool IsLast(CollectionElementViewModel element)
        {
            if (!ChildElements.Any())
            {
                return(false);
            }

            return(ChildElements.Last().ElementId == element.ElementId);
        }