コード例 #1
0
        /// <summary>
        /// Selects then zero-based nth th and td cells from all rows in any matched tables.
        /// DOES NOT ACCOUNT FOR COLSPAN. If you have inconsistent numbers of columns, you will get inconsistent results.
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        public CQ GetTableColumn(int column)
        {
            CQ result = New();

            foreach (var el in filterElements(this, "table"))
            {
                result.AddSelectionRange(el.Cq().Find(String.Format("tr>th:eq({0}), tr>td:eq({0})", column)));
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Given a table header or cell, returns all members of the columm.
        /// </summary>
        /// <param name="columnMember"></param>
        /// <returns></returns>
        public CQ GetTableColumn()
        {
            var els    = this.Filter("th,td");
            CQ  result = New();

            foreach (var el in els)
            {
                var elCq     = el.Cq();
                int colIndex = elCq.Index();
                result.AddSelectionRange(elCq.Closest("table").GetTableColumn(colIndex));
            }
            return(result);
        }