private static List <GridSpanInfo[]> PrepareCellSpans(this Word.Table table) { var rowSpans = table .Rows() .Select(row => { var rowColIndex = 0; var rowCellSpans = row .Cells() .Select(cell => { var(rowSpan, colSpan) = cell.GetCellSpans(); var cellInfo = new GridSpanInfo { RowSpan = rowSpan, ColSpan = colSpan, Column = rowColIndex }; rowColIndex += colSpan; return(cellInfo); }) .ToArray(); return(rowCellSpans); }) .ToList(); return(rowSpans); }
public static IEnumerable <Cell> InitializeCells( this Word.Table table, IImageAccessor imageAccessor, IStyleFactory styleFactory) { var spans = table.PrepareCellSpans(); var cells = table .Rows() .SelectMany((row, index) => { var rowCells = row.InitializeCells(index, spans, imageAccessor, styleFactory); return(rowCells); }) .Where(c => !c.GridPosition.IsRowMergedCell) .ToArray(); return(cells); }