Exemplo n.º 1
0
        private void ProcessTr(DocxNode tr, Table table, DocxTableProperties tableProperties)
        {
            if (tr.HasChildren)
            {
                TableRow row = new TableRow();

                DocxTableRowStyle style = new DocxTableRowStyle();
                style.Process(row, tableProperties);

                int colIndex = 0;

                foreach (DocxNode td in tr.Children)
                {
                    ProcessVerticalSpan(ref colIndex, row, tableProperties);

                    tableProperties.IsCellHeader = string.Compare(td.Tag, DocxTableProperties.thName, StringComparison.InvariantCultureIgnoreCase) == 0;

                    if (string.Compare(td.Tag, DocxTableProperties.tdName, StringComparison.InvariantCultureIgnoreCase) == 0 || tableProperties.IsCellHeader)
                    {
                        tr.CopyExtentedStyles(td);
                        ProcessTd(colIndex++, td, row, tableProperties);
                    }
                }

                if (colIndex < tableProperties.RowSpanInfo.Count)
                {
                    ProcessVerticalSpan(ref colIndex, row, tableProperties);
                }

                table.Append(row);
            }
        }
Exemplo n.º 2
0
        private void ProcessTr(DocxNode tr, Table table, DocxTableProperties tableProperties)
        {
            if (tr.HasChildren)
            {
                TableRow row = new TableRow();

                DocxTableRowStyle style = new DocxTableRowStyle();
                style.Process(row, tableProperties);

                int colIndex = 0;

                foreach (DocxNode td in tr.Children)
                {
                    ProcessVerticalSpan(ref colIndex, row, tableProperties);

                    tableProperties.IsCellHeader = string.Compare(td.Tag, DocxTableProperties.thName, StringComparison.InvariantCultureIgnoreCase) == 0;

                    if (string.Compare(td.Tag, DocxTableProperties.tdName, StringComparison.InvariantCultureIgnoreCase) == 0 || tableProperties.IsCellHeader)
                    {
                        tr.CopyExtentedStyles(td);
                        ProcessTd(colIndex++, td, row, tableProperties);
                    }
                }

                if (colIndex < tableProperties.RowSpanInfo.Count)
                {
                    ProcessVerticalSpan(ref colIndex, row, tableProperties);
                }

                table.Append(row);
            }
        }