temp commit - hepl method

This commit is contained in:
Michal Buzik 2024-10-25 09:27:33 +02:00
parent 2023ea5221
commit 203c2498ac
2 changed files with 60 additions and 0 deletions

View File

@ -277,6 +277,7 @@ namespace Results.Output.Printers.OnePerMeter
VertLines = TableLines.All
};
table = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style);
table.CheckLastTableRowIfPossibleMerge(true, true);
break;
case TableForm.Columns:

View File

@ -309,6 +309,65 @@ namespace Results.Output
return table;
}
public void CheckLastTableRowIfPossibleMerge(bool mergeNegative, bool mergePositive)
{
bool hasNegativeAll = true;
bool hasPositiveAll = true;
bool hasMixed = false;
string lastRowText = null;
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
{
string text = Cells[rowIx][ColumnsCount - 1].Text;
if (mergeNegative)
{
if (text != "-")
{
hasNegativeAll = false;
}
if (text != "+")
{
hasPositiveAll = false;
}
if (!hasMixed)
{
if (lastRowText == null)
{
lastRowText = text;
}
else
{
if (lastRowText != text)
{
hasMixed = true;
}
lastRowText = text;
}
}
}
}
if (hasMixed)
{
//merge as negative
} else if (hasPositiveAll)
{
//merge as positive
}
else if (hasNegativeAll)
{
//merge as negative
}
}
/// <summary>
/// Create a table where tests are in columns.
/// Left column contains item (or row) captions.