private void AddTableRepeatSection(WordTableDef tableDef, XmlNode node) { var dataSetAttr = node.Attributes != null ? node.Attributes["dataset"] : null; var dataSet = dataSetAttr != null ? _dataSets[dataSetAttr.Value] : _dataSets.First().Value; var reset = node.Attributes != null && node.Attributes["reset"] != null; var oldStyle = new ContentStyle(_style); try { SetSectionStyle(node); var sectionDef = tableDef.AddSection(new WordTableRepeatSectionDef(dataSet) { ResetDatas = reset, Style = _style }); _dataSetStack.Push(dataSet); try { foreach (XmlNode child in node.ChildNodes) { if (String.Equals(child.Name, "tr", StringComparison.OrdinalIgnoreCase)) { AddTableRow(sectionDef, child /*, ref rowNo*/); } } } finally { _dataSetStack.Pop(); } } finally { _style.Assign(oldStyle); } }
private void AddTable(WordGroupDef wordDoc, XmlNode table) { var oldStyle = new ContentStyle(_style); try { SetSectionStyle(table); var tableDef = new WordTableDef { Style = _style }; wordDoc.AddItem(tableDef); var tableFullWidth = table.Attributes != null ? table.Attributes["fullwidth"] : null; tableDef.FitWidth = tableFullWidth != null; // var rowNo = 0; var repeatSection = true; foreach (XmlNode child in table.ChildNodes) { if (String.Equals(child.Name, "tr", StringComparison.OrdinalIgnoreCase)) { var tableSectionDef = repeatSection ? tableDef.AddSection(new WordTableSectionDef()) : tableDef.Sections.LastOrDefault(); AddTableRow(tableSectionDef, child /*, ref rowNo*/); repeatSection = false; } else if (String.Equals(child.Name, "repeat", StringComparison.OrdinalIgnoreCase)) { AddTableRepeatSection(tableDef, child /*, ref rowNo*/); repeatSection = true; } } } finally { _style.Assign(oldStyle); } }