From 905c00868a4e50780ae93dfb097c12f7807295d3 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 1 Oct 2012 15:17:00 +0000 Subject: [PATCH] B2012-242, fixed the table conversion logic to handle merged rows in the last column of a table and to better handle more than two merged rows in the middle of a table --- PROMS/Volian.Controls.Library/VlnFlexGrid.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index 1dd8d912..526e98cf 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -3777,6 +3777,19 @@ namespace Volian.Controls.Library } else // parsed text contains all dashes { + // take a peek at the start of the next piece of table text to parse + // if it starts with a space, return, newline, or EndOfFile char, + // then flag to merge the columns up to + // this point with the same columns in the next row + if (idx < txtbuff.Length - 1 && " \r\n\x02".IndexOf(txtbuff[idx + 1]) > 0) + { + int nextCol = (curCol + 1 > this.Cols.Count) ? curCol : curCol + 1; + if (!tci[curRow, nextCol].ColEnd) + tci[curRow, nextCol].MergeRowBellow = true; + //for (int c = nextCol; c >= 0; c--) + // if (!tci[curRow, c].ColEnd) + // tci[curRow, c].MergeRowBellow = true; + } tci[curRow, curCol].ColEnd = true; incRow = true; } @@ -3825,7 +3838,7 @@ namespace Volian.Controls.Library else if (tstr.Length > 0) // parsed text is all dash characters { incRow = true; - if (curRow > 0) // merge the column in the previous row with this one + if (curRow > 0 && curCol > 0) // merge the column in the previous row with this one tci[curRow - 1, curCol].MergeRowBellow = false; } // if were are that the end of the 16-bit text line, but not in the last column,