From d0c27fcb4389cf25ad1cebce17d6c6d5c1fbbcbb Mon Sep 17 00:00:00 2001 From: John Date: Thu, 12 Mar 2020 18:47:50 +0000 Subject: [PATCH] B2020-034 Added logic to adjust the vertical position of the text in a table cell based on the font size. --- PROMS/Volian.Print.Library/Grid2Pdf.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index a7546525..ff80c0e9 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -985,7 +985,11 @@ public string Path public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) { foreach (vlnCell myCell in this) - myCell.ToPdf(myColumnText, left, top); + { + // B2020-034 - the topPlacementAdjust is used to position the text vertically in the table cells. + int topPlacementAdjust = (myCell.MyPara.Font.Size == 12)? 1 : 3; // for font size of 12 set to one, else set to 3 + myCell.ToPdf(myColumnText, left, top, topPlacementAdjust); + } } #endregion } @@ -1353,7 +1357,7 @@ public string Path cb.RestoreState(); } //RHM 20180319 End of Add - public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) + public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, int topPlacementAdjust) { myColumnText.Canvas.SaveState(); VlnSvgPageHelper _MyPageHelper = myColumnText.Canvas.PdfWriter.PageEvent as VlnSvgPageHelper; @@ -1381,7 +1385,8 @@ public string Path // this will have the cell text print a little more toward the top of the cell //myColumnText1.SetSimpleColumn(1 + left + x, top - y - h, left + x + w - 2, 3 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding // B2019-109 Adjusted width of cell to match edit cell - myColumnText1.SetSimpleColumn(.5F + left + x, top - y - h, left + x + w - 1.5F, 3 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding + // B2020-034 - use the passed in topPlacementAdjust value which is set based on the font size. + myColumnText1.SetSimpleColumn(.5F + left + x, top - y - h, left + x + w - 1.5F, topPlacementAdjust + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding // B2018-003 - RHM 20180319 Change Debug Output string dbg = string.Format("Row={0}, Col={1}, Leading={2}, SpacingBefore={3}", r1, c1, MyPara.TotalLeading * _MyPageHelper.YMultiplier, MyPara.SpacingBefore); // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13