Beispiel #1
0
        private void writeElement(string type, System.Windows.Forms.HtmlElement element)
        {
            sheet.WriteNextRow();
            sheet.WriteTextCell(1, _writer.AddSharedString(type));
            string attr = null, attrValue = null;

            IHTMLDOMNode       node    = element.DomElement as IHTMLDOMNode;
            IHTMLDOMAttribute2 domAttr = null;
            int columnIndex            = 2;

            for (; columnIndex - 2 < _excelColumnHeader.Count; columnIndex++)
            {
                attr = _excelColumnHeader[columnIndex - 2] as string;
                if (string.IsNullOrEmpty(attr))
                {
                    attrValue = "";
                }
                else
                {
                    domAttr = node.attributes.getNamedItem(attr);
                    if (domAttr != null)
                    {
                        attrValue = domAttr.value;
                    }
                }
                if (attrValue != "null" && string.IsNullOrEmpty(attrValue) == false)
                {
                    sheet.WriteTextCell(columnIndex, _writer.AddSharedString(attrValue));
                }
                attrValue = null;
                domAttr   = null;
            }
        }
Beispiel #2
0
        public AttributeAdapter(object attribute, IHtmlElement element)
        {
            _attribute  = attribute as IHTMLDOMAttribute;
            _attribute2 = attribute as IHTMLDOMAttribute2;

            _element = element;

            _raw = attribute;
        }
Beispiel #3
0
    public AttributeAdapter( object attribute, IHtmlElement element )
    {
      _attribute = attribute as IHTMLDOMAttribute;
      _attribute2 = attribute as IHTMLDOMAttribute2;

      _element = element;

      _raw = attribute;
    }
Beispiel #4
0
        protected override bool OnCheckBoxElementFinded(HtmlElement checkElement, Stack <KeyValuePair <HtmlElement, string> > textNode)
        {
            IHTMLDOMNode       node = checkElement.DomElement as IHTMLDOMNode;
            IHTMLDOMAttribute2 attr = node.attributes == null ? null : node.attributes.getNamedItem("title");

            if (attr != null && attr.value != "null" && string.IsNullOrEmpty(attr.value) == false)
            {
                textNode.Push(new KeyValuePair <HtmlElement, string>(checkElement, attr.value));
            }
            return(base.OnCheckBoxElementFinded(checkElement, textNode));
        }
Beispiel #5
0
        protected override bool OnOtherElementFinded(HtmlElement element)
        {
            IHTMLDOMNode       node = element.DomElement as IHTMLDOMNode;
            IHTMLDOMAttribute2 attr = node.attributes == null ? null : node.attributes.getNamedItem("ondblclick");

            if (attr != null && attr.value != "null" && string.IsNullOrEmpty(attr.value) == false)
            {
                attr = node.attributes.getNamedItem("title");
                string title = (attr == null || attr.value == "null") ? "" : attr.value;
                base.writeElement(title, element.TagName, element);
            }
            return(base.OnOtherElementFinded(element));
        }
Beispiel #6
0
        protected void writeElement(string fieldType, string field, string type, string options, HtmlElement element)
        {
            _sheet.WriteNextRow();
            _sheet.WriteTextCell(1, _writer.AddSharedString(fieldType));
            if (string.IsNullOrEmpty(field) == false)
            {
                _sheet.WriteTextCell(2, _writer.AddSharedString(field));
            }
            if (string.IsNullOrEmpty(type) == false)
            {
                _sheet.WriteTextCell(3, _writer.AddSharedString(type));
            }
            HtmlElement frameElement = element.Document.Window.WindowFrameElement;
            string      frameId      = (frameElement == null || string.IsNullOrEmpty(frameElement.Id)) ? "" : frameElement.Id;

            _sheet.WriteTextCell(4, _writer.AddSharedString(frameId));
            _sheet.WriteTextCell(5, _writer.AddSharedString(element.Document.Url.OriginalString));
            string attr = null, attrValue = null;

            IHTMLDOMNode       node    = element.DomElement as IHTMLDOMNode;
            IHTMLDOMAttribute2 domAttr = null;
            int columnIndex            = 6;

            for (; columnIndex - 6 < _excelColumnHeader.Count; columnIndex++)
            {
                attr = _excelColumnHeader[columnIndex - 6] as string;
                if (string.IsNullOrEmpty(attr))
                {
                    attrValue = "";
                }
                else
                {
                    domAttr = node.attributes == null ? null : node.attributes.getNamedItem(attr);
                    if (domAttr != null)
                    {
                        attrValue = domAttr.value;
                    }
                }
                if (attrValue != "null" && string.IsNullOrEmpty(attrValue) == false)
                {
                    _sheet.WriteTextCell(columnIndex, _writer.AddSharedString(attrValue));
                }
                attrValue = null;
                domAttr   = null;
            }
            if (string.IsNullOrEmpty(options) == false)
            {
                _sheet.WriteTextCell(columnIndex, _writer.AddSharedString(options));
            }
        }