From 79c31a3128e93d576b056ee42581a2c0d22b738d Mon Sep 17 00:00:00 2001 From: gost Date: Mon, 15 Apr 2019 16:55:28 +0300 Subject: [PATCH] Fixed the formation of complex table elements. --- MariGold.OpenXHTML/Elements/DocxTable.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/MariGold.OpenXHTML/Elements/DocxTable.cs b/MariGold.OpenXHTML/Elements/DocxTable.cs index 26c3278..7c2b57a 100644 --- a/MariGold.OpenXHTML/Elements/DocxTable.cs +++ b/MariGold.OpenXHTML/Elements/DocxTable.cs @@ -100,7 +100,14 @@ private void ProcessVerticalSpan(ref int colIndex, TableRow row, DocxTableProper cell.TableCellProperties = new TableCellProperties(); cell.TableCellProperties.Append(new VerticalMerge()); - + // There should be a more elegant solution for drawing borders. + cell.TableCellProperties.Append(new LeftBorder() { + Val = BorderValues.Single, + Color = "auto", + Size = (UInt32Value)4U, + Space = (UInt32Value)0U + }); + // cell.AppendChild(new Paragraph()); row.Append(cell); @@ -124,6 +131,13 @@ private void ProcessTr(DocxNode tr, Table table, DocxTableProperties tableProper foreach (DocxNode td in tr.Children) { + if (Int32.TryParse(td.ExtractAttributeValue("colspan"), out value)) + { + if (value > 1) + { + colIndex += value - 1; + } + } ProcessVerticalSpan(ref colIndex, row, tableProperties); tableProperties.IsCellHeader = string.Compare(td.Tag, DocxTableProperties.thName, StringComparison.InvariantCultureIgnoreCase) == 0;