B2020-034 Added logic to adjust the vertical position of the text in a table cell based on the font size.

This commit is contained in:
John Jenko 2020-03-12 18:47:50 +00:00
parent c0246d2421
commit d0c27fcb43

View File

@ -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