/// <summary> /// append child element /// </summary> /// <param name="element">child element</param> /// <returns>index of element</returns> public int AppendChild(RTFDomElement element) { CheckLocked(); element.myParent = this; element.OwnerDocument = this.myOwnerDocument; return(myElements.Add(element)); }
/// <summary> /// 判断对象是否有实际内容 /// </summary> /// <param name="rootElement">根元素对象</param> /// <returns>是否有实际内容</returns> public static bool HasContentElement(RTFDomElement rootElement) { if (rootElement.Elements.Count == 0) { return(false); } if (rootElement.Elements.Count == 1) { if (rootElement.Elements[0] is RTFDomParagraph) { RTFDomParagraph p = (RTFDomParagraph)rootElement.Elements[0]; if (p.Elements.Count == 0) { return(false); } } } return(true); }
/// <summary> /// Get the index of special element that starts with 0. /// </summary> /// <param name="element">element</param> /// <returns>index , if not find element , then return -1</returns> public int IndexOf(RTFDomElement element) { return(this.List.IndexOf(element)); }
/// <summary> /// insert element /// </summary> /// <param name="index">special index</param> /// <param name="element">element</param> public void Insert(int index, RTFDomElement element) { this.List.Insert(index, element); }
/// <summary> /// add element /// </summary> /// <param name="element">element</param> /// <returns>index</returns> public int Add(RTFDomElement element) { return(this.List.Add(element)); }
/// <summary> /// delete element /// </summary> /// <param name="node">element</param> public void Remove(RTFDomElement node) { this.List.Remove(node); }