Exemplo n.º 1
0
        internal static Table ParseTable(HtmlNode node)
        {
            Table table = new Table();
            if (node.Name.ToLower() != "table")
            {
                return table;
            }

            int row = 0;
            foreach (HtmlNode rowNode in node.Descendants("tr"))
            {
                int column = 0;
                foreach (HtmlNode cellNode in rowNode.Descendants().Where(c => c.Name.ToLower() == "th" || c.Name.ToLower() == "td"))
                {
                    table.AddItem(cellNode, row, column);
                    column++;
                }
                row++;
            }

            return table;
        }
Exemplo n.º 2
0
 private void CreateTableContents(Table table, bool hasBorder)
 {
     int row = 0;
     foreach (TableRow tableRow in table.Rows)
     {
         int column = 0;
         foreach (TableCell tableCell in tableRow.Cells)
         {
             if (tableCell.Content != null)
             {
                 CreateTableCell(tableCell.Content, row, column, tableCell.IsHeader, tableCell.RowSpan, tableCell.ColSpan, hasBorder);
             }
             column++;
         }
         row++;
     }
 }