private static ExportRow ExportRow(TableRow tableRow) { var row = new ExportRow(tableRow.HorizontalAlign); tableRow.Cells.OfType<TableCell>() .Where(c => c.Visible) .Select(ExportCell) .ForEach(row.AddCell); return row; }
private static void VisitTableCell(HtmlTag cell, ExportRow exportRow) { var tag = cell.TagName().ToLower(); if (tag != HtmlTagConstants.Td && tag != HtmlTagConstants.Th) { cell.Children.ForEach(c => VisitTableCell(c, exportRow)); return; } var isImage = cell.Children.Any(c => c.TagName().ToLower() == HtmlTagConstants.Img); var text = cell.Children.Any() ? cell.ToString() : cell.Text(); var exportCell = new ExportCell { Text = ExportFromTable.HtmlTagRegex.Replace(text ?? string.Empty, string.Empty), Markup = isImage ? cell.FirstChild().ToString():string.Empty }; SetColspan(cell, exportCell); exportRow.AddCell(exportCell); }
public void AddRow(ExportRow row) { Rows.Add(row); }
public override void Visit(ExportRow row, Action inner) { StartTag(HtmlTextWriterTag.Tr); inner(); EndTag(); }
public abstract void Visit(ExportRow row, Action inner);
public override void Visit(ExportRow row, Action inner) { inner(); StripTrailingSeparator(); AppendRowDelimiter(); }
private void VisitTableRow(HtmlTag row) { var exportRow = new ExportRow(HorizontalAlign.NotSet); _Table.AddRow(exportRow); row.Children.ForEach(c => VisitTableCell(c, exportRow)); }
private static void VisitTableCell(HtmlTag cell, ExportRow exportRow) { var tag = cell.TagName().ToLower(); if (tag != HtmlTagConstants.Td && tag != HtmlTagConstants.Th ) { cell.Children.ForEach(c => VisitTableCell(c, exportRow)); return; } var isImage = cell.Children.Any(c => c.TagName().ToLower() == HtmlTagConstants.Img); var text = cell.Children.Any() ? cell.ToString() : cell.Text(); var exportCell = new ExportCell { Text = ExportFromTable.HtmlTagRegex.Replace(text ?? string.Empty, string.Empty), Markup = isImage ? cell.FirstChild().ToString():string.Empty }; SetColspan(cell, exportCell); exportRow.AddCell(exportCell); }