(1) Output.Printers.OnePerMeter : Table{s} centered horizontally on pages, (2) Indicators for PL: "brak"

This commit is contained in:
Milan Hanajik
2018-04-11 15:09:58 +02:00
parent fe3867bc5c
commit 85f2f31469
2 changed files with 35 additions and 26 deletions
@@ -152,7 +152,7 @@ namespace Results.Output.Printers.OnePerMeter
}
}
float bodyTop = cfg.TopMargin;
float tableTop = cfg.TopMargin;
if (pageNr == 1)
{
@@ -192,43 +192,44 @@ namespace Results.Output.Printers.OnePerMeter
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
Table table = new Table(2) { Style = commonTableStyle };
Table table1 = new Table(2) { Style = commonTableStyle };
foreach (var v in commonItems1)
{
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
table.AddRow(row, horizAlgn, vertAlgn);
table1.AddRow(row, horizAlgn, vertAlgn);
}
float bodyTop1 = table.Draw(e, leftMarginCommon1, commonTop);
float bodyTop1 = table1.Draw(e, leftMarginCommon1, commonTop);
table = new Table(2) { Style = commonTableStyle };
table1 = new Table(2) { Style = commonTableStyle };
foreach (var v in commonItems2)
{
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
table.AddRow(row, horizAlgn, vertAlgn);
table1.AddRow(row, horizAlgn, vertAlgn);
}
float bodyTop2 = table.Draw(e, leftMarginCommon2, commonTop);
float bodyTop2 = table1.Draw(e, leftMarginCommon2, commonTop);
table = new Table(2) { Style = commonTableStyle };
table1 = new Table(2) { Style = commonTableStyle };
foreach (var v in commonItems3)
{
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
table.AddRow(row, horizAlgn, vertAlgn);
table1.AddRow(row, horizAlgn, vertAlgn);
}
float bodyTop3 = table.Draw(e, leftMarginCommon3, commonTop);
float bodyTop3 = table1.Draw(e, leftMarginCommon3, commonTop);
float bodyTop12 = (bodyTop1 > bodyTop2) ? bodyTop1 : bodyTop2;
bodyTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s
bodyTop += spacingOne4Header; /// Space between the common part and the table
tableTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s
tableTop += spacingOne4Header; /// Space between the common part and the table
}
///
/// Draw table
/// Draw table (on the 1st, as well as on the 2nd page)
///
float belowTop;
TableStyle style;
Table table;
switch (cfg.Form)
{
default:
@@ -245,7 +246,7 @@ namespace Results.Output.Printers.OnePerMeter
HorizLines = TableLines.All,
VertLines = TableLines.FirstSecondAndLast
};
belowTop = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style).Draw(e, (float)leftMargin, bodyTop);
table = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style);
break;
case TableForm.Columns:
@@ -261,7 +262,7 @@ namespace Results.Output.Printers.OnePerMeter
HorizLines = TableLines.FirstSecondAndLast,
VertLines = TableLines.All
};
belowTop = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style).Draw(e, (float)leftMargin, bodyTop);
table = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style);
break;
case TableForm.ColumnsPL:
@@ -277,10 +278,13 @@ namespace Results.Output.Printers.OnePerMeter
HorizLines = TableLines.FirstSecondAndLast,
VertLines = TableLines.All
};
belowTop = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style).Draw(e, (float)leftMargin, bodyTop);
table = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style);
break;
}
SizeF size = table.Measure(e);
float tableLeft = (float)leftMargin + ((float)printWidth - size.Width) / 2;
belowTop = table.Draw(e, tableLeft, tableTop);
if (pageNr == nrPages)
{
@@ -296,31 +300,31 @@ namespace Results.Output.Printers.OnePerMeter
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
Table table = new Table(2) { Style = commonTableStyle };
Table table2 = new Table(2) { Style = commonTableStyle };
foreach (var v in belowItems1)
{
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
table.AddRow(row, horizAlgn, vertAlgn);
table2.AddRow(row, horizAlgn, vertAlgn);
}
table.Draw(e, leftMarginBelow1, belowTop);
table2.Draw(e, leftMarginBelow1, belowTop);
table = new Table(2) { Style = commonTableStyle };
table2 = new Table(2) { Style = commonTableStyle };
foreach (var v in belowItems2)
{
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
table.AddRow(row, horizAlgn, vertAlgn);
table2.AddRow(row, horizAlgn, vertAlgn);
}
table.Draw(e, leftMarginBelow2, belowTop);
table2.Draw(e, leftMarginBelow2, belowTop);
table = new Table(2) { Style = commonTableStyle };
table2 = new Table(2) { Style = commonTableStyle };
foreach (var v in belowItems3)
{
string[] row = new string[] { v.Caption, (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty };
table.AddRow(row, horizAlgn, vertAlgn);
table2.AddRow(row, horizAlgn, vertAlgn);
}
table.Draw(e, leftMarginBelow3, belowTop);
table2.Draw(e, leftMarginBelow3, belowTop);
///