private void AddTableRow(WordTableSectionDef tableSectionDef, XmlNode row /*, ref int rowNo*/) { var oldStyle = new ContentStyle(_style); try { SetSectionStyle(row); var rowDef = tableSectionDef.AddRow(/*rowNo*/); rowDef.Style = _style; var colNo = 0; foreach (XmlNode child in row.ChildNodes) { if (child.NodeType == XmlNodeType.Element && String.Equals(child.Name, "td", StringComparison.OrdinalIgnoreCase)) { AddTableCell(rowDef, child, ref colNo); } } //rowNo++; } finally { _style.Assign(oldStyle); } }
public WordTableRowDef InsertRow(int rowNo) { var section = _sections.LastOrDefault(); if (section == null) { section = new WordTableSectionDef(); _sections.Add(section); } return(section.InsertRow(rowNo)); }
public WordTableRowDef AddRow(/*int rowNo*/) { var section = _sections.LastOrDefault(); if (section == null) { section = new WordTableSectionDef(); _sections.Add(section); } return(section.AddRow(/*rowNo*/)); }
private void BuildTableSectionRows(WordTableSectionDef sectionDef, Table table, WordTableDef tableDef, ref bool firstRow) { foreach (var rowDef in sectionDef.GetRows()) { //if (tableDef.Rows.ContainsKey(r)) { //var rowDef = tableDef.Rows[r]; var oldRowStyle = MergeStyle(rowDef.Style); try { var row = firstRow ? table.Rows[0] : table.InsertRow(); firstRow = false; for (var c = 0; c < tableDef.GetColCount(); c++) { if (rowDef.Cells.ContainsKey(c)) { var cellDef = rowDef.Cells[c]; var oldCellStyle = MergeStyle(cellDef.Style); try { var cellPara = AppendParagraph(/*table.Rows[r]*/ row.Cells[c]); //SetParagraphFormat(cellPara); foreach (var itemDef in cellDef.Items) { if (itemDef is WordContentItemDef) { AddParagraphContent(cellPara, (WordContentItemDef)itemDef); } } } finally { SetStyle(oldCellStyle); } } else { AppendParagraph(row.Cells[c]); } } } finally { SetStyle(oldRowStyle); } } } }
public WordTableSectionDef AddSection(WordTableSectionDef section) { _sections.Add(section); return(section); }