Пример #1
0
        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);
            }
        }
Пример #2
0
        public WordTableRowDef InsertRow(int rowNo)
        {
            var section = _sections.LastOrDefault();

            if (section == null)
            {
                section = new WordTableSectionDef();
                _sections.Add(section);
            }

            return(section.InsertRow(rowNo));
        }
Пример #3
0
        public WordTableRowDef AddRow(/*int rowNo*/)
        {
            var section = _sections.LastOrDefault();

            if (section == null)
            {
                section = new WordTableSectionDef();
                _sections.Add(section);
            }

            return(section.AddRow(/*rowNo*/));
        }
Пример #4
0
        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);
                    }
                }
            }
        }
Пример #5
0
 public WordTableSectionDef AddSection(WordTableSectionDef section)
 {
     _sections.Add(section);
     return(section);
 }