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
This commit is contained in:
John Jenko 2012-10-01 15:17:00 +00:00
parent 2d61936fb3
commit 905c00868a

View File

@ -3777,6 +3777,19 @@ namespace Volian.Controls.Library
} }
else // parsed text contains all dashes 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; tci[curRow, curCol].ColEnd = true;
incRow = true; incRow = true;
} }
@ -3825,7 +3838,7 @@ namespace Volian.Controls.Library
else if (tstr.Length > 0) // parsed text is all dash characters else if (tstr.Length > 0) // parsed text is all dash characters
{ {
incRow = true; 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; tci[curRow - 1, curCol].MergeRowBellow = false;
} }
// if were are that the end of the 16-bit text line, but not in the last column, // if were are that the end of the 16-bit text line, but not in the last column,