C2021-005 code to adjust the starting vertical position of table cell text when the font size changes
This commit is contained in:
parent
4aa104436f
commit
00f53b5469
@ -343,7 +343,7 @@ public string Path
|
|||||||
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
||||||
{
|
{
|
||||||
//ZoomGrid(myColumnText, left, top);
|
//ZoomGrid(myColumnText, left, top);
|
||||||
if(ShowDetails) Console.WriteLine("vvvvvvToPdf============{0}===============", ItemID);// RHM20150525 - Table Scrunc
|
if (ShowDetails) Console.WriteLine("vvvvvvToPdf============{0}===============", ItemID);// RHM20150525 - Table Scrunc
|
||||||
ShowRowTops("ToPDF1");
|
ShowRowTops("ToPDF1");
|
||||||
PdfContentByte cb = myColumnText.Canvas; // RHM20150429 - Table Scrunch
|
PdfContentByte cb = myColumnText.Canvas; // RHM20150429 - Table Scrunch
|
||||||
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
@ -498,6 +498,10 @@ public string Path
|
|||||||
TrimNewlines(myPara); // RHM20150429 - Table Scrunch
|
TrimNewlines(myPara); // RHM20150429 - Table Scrunch
|
||||||
myColumnText1.AddElement(myPara);
|
myColumnText1.AddElement(myPara);
|
||||||
//myColumnText1.Canvas.SetColorFill(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
//myColumnText1.Canvas.SetColorFill(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||||
|
|
||||||
|
// PIP TEST CODE FOR TABLE SHADING
|
||||||
|
//myColumnText1.Canvas.SetColorFill(new iTextSharp.text.Color(System.Drawing.Color.Red));
|
||||||
|
|
||||||
float posBefore = myColumnText1.YLine;
|
float posBefore = myColumnText1.YLine;
|
||||||
int status = myColumnText1.Go(true);
|
int status = myColumnText1.Go(true);
|
||||||
float posAfter = myColumnText1.YLine;
|
float posAfter = myColumnText1.YLine;
|
||||||
@ -1018,6 +1022,20 @@ public string Path
|
|||||||
private static float _SixLinesPerInch = 12; // twips
|
private static float _SixLinesPerInch = 12; // twips
|
||||||
#endregion
|
#endregion
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
// C2021-005 Get the largest font size being used.
|
||||||
|
// - only need for the first line of table cell text
|
||||||
|
private float GetLargestFontSize(vlnCell vc)
|
||||||
|
{
|
||||||
|
float largestFontSize = 12;
|
||||||
|
foreach (Chunk ck in vc.MyPara)
|
||||||
|
{
|
||||||
|
if (ck.Content.EndsWith("\n"))
|
||||||
|
break; // end of first line
|
||||||
|
if (ck.ToString().Trim().Length > 0)
|
||||||
|
largestFontSize = Math.Max(largestFontSize, ck.Font.Size);
|
||||||
|
}
|
||||||
|
return largestFontSize;
|
||||||
|
}
|
||||||
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
||||||
{
|
{
|
||||||
foreach (vlnCell myCell in this)
|
foreach (vlnCell myCell in this)
|
||||||
@ -1026,12 +1044,18 @@ public string Path
|
|||||||
// B2020-082 - AEP Production - American Electric Power - D. C. Cook
|
// B2020-082 - AEP Production - American Electric Power - D. C. Cook
|
||||||
// / Current (Post FLEX) - U1 NOP NOT [EOPs] - ES-3.3.SProcedure Body.S9..S1..S1..T1.
|
// / Current (Post FLEX) - U1 NOP NOT [EOPs] - ES-3.3.SProcedure Body.S9..S1..S1..T1.
|
||||||
// Table did not print properly. Cell text was truncated.
|
// Table did not print properly. Cell text was truncated.
|
||||||
|
float largestFontSize = GetLargestFontSize(myCell); // C2021-005 get the largest font size for the cell text
|
||||||
int topPlacementAdjust = (myCell.MyPara.Font.Size == 12 &&
|
int topPlacementAdjust = (myCell.MyPara.Font.Size == 12 &&
|
||||||
myCell.MyPara.Font.Familyname != "Courier New" &&
|
myCell.MyPara.Font.Familyname != "Courier New" &&
|
||||||
myCell.MyPara.Font.Familyname != "VESymbFix") ? 1 : 3; // for font size of 12 set to one, else set to 3
|
myCell.MyPara.Font.Familyname != "VESymbFix") ? 1 : 3; // for font size of 12 set to one, else set to 3
|
||||||
// B2020-140 for Wolf Creek check boxes in tables were printing too hight in the table cells - added format variable to overide topPlacementAdjust
|
if (largestFontSize != 12) // C2021-005 adjust the text positon based on the font size change
|
||||||
if (myCell.MyPara !=null && ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent != null)
|
topPlacementAdjust -= (int)(largestFontSize - 12); // C2021-005 adjust placement based on font size change
|
||||||
|
// B2020-140 for Wolf Creek check boxes in tables were printing too high in the table cells - added format variable to overide topPlacementAdjust
|
||||||
|
if (myCell.MyPara != null && ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent != null)
|
||||||
|
{
|
||||||
|
if (largestFontSize > 18) // C2021-005 Only need when cell text has the empty box symbol which WCN format override the size to 20pts
|
||||||
topPlacementAdjust = (int)ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent;
|
topPlacementAdjust = (int)ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent;
|
||||||
|
}
|
||||||
myCell.ToPdf(myColumnText, left, top, topPlacementAdjust);
|
myCell.ToPdf(myColumnText, left, top, topPlacementAdjust);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1578,6 +1602,9 @@ public string Path
|
|||||||
float yTop = top - y + YOffset;
|
float yTop = top - y + YOffset;
|
||||||
float xRight = left + x + w + XOffset;
|
float xRight = left + x + w + XOffset;
|
||||||
float yBottom = top - y - h + YOffset;
|
float yBottom = top - y - h + YOffset;
|
||||||
|
// PIP TESTING SHADING CELLS
|
||||||
|
//FillRectangle(cb, xLeft, xRight, yTop-2, yBottom, Color.GREEN, Color.MAGENTA);
|
||||||
|
|
||||||
// ZoomToCell(myColumnText, xLeft, yTop, xRight, yBottom);
|
// ZoomToCell(myColumnText, xLeft, yTop, xRight, yBottom);
|
||||||
// Draw Top Side for the first row
|
// Draw Top Side for the first row
|
||||||
if (r1 == 0)
|
if (r1 == 0)
|
||||||
@ -1590,7 +1617,29 @@ public string Path
|
|||||||
// Draw Right Side
|
// Draw Right Side
|
||||||
DrawLineVertical(cb, "Right", xRight, yBottom, yTop, RightSide, RightOfBottomSide, BottomSide, BelowRightSide, TopSide, RightOfTopSide, AboveRightSide);
|
DrawLineVertical(cb, "Right", xRight, yBottom, yTop, RightSide, RightOfBottomSide, BottomSide, BelowRightSide, TopSide, RightOfTopSide, AboveRightSide);
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
|
|
||||||
|
// PIP TESTING SHADING CELLS
|
||||||
|
//FillRectangle(cb, xLeft, xRight, yTop, yBottom, Color.GREEN, Color.MAGENTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PIP TESTING SHADING CELLS
|
||||||
|
private void FillRectangle(PdfContentByte cb, float xLeft, float xRight, float yTop, float yBottom, Color FillColor, Color OutlineColor)
|
||||||
|
{
|
||||||
|
cb.SaveState();
|
||||||
|
//bool fill = FillColor != System.Drawing.Color.Transparent;
|
||||||
|
//bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty;
|
||||||
|
//if (fill)
|
||||||
|
cb.SetColorFill(FillColor);
|
||||||
|
//if (stroke)
|
||||||
|
//{
|
||||||
|
cb.SetLineWidth(.5f);//scale.M(OutlineWidth));
|
||||||
|
cb.SetColorStroke(OutlineColor);
|
||||||
|
//}
|
||||||
|
cb.RoundRectangle(xLeft, yBottom, xRight-xLeft, yTop-yBottom, .005F);
|
||||||
|
cb.Fill();//.FillStroke();
|
||||||
|
cb.RestoreState();
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawHorizontalLine(PdfContentByte cb, string side, float xStart, float xEnd, float y, GridLinePattern LinePattern,
|
private void DrawHorizontalLine(PdfContentByte cb, string side, float xStart, float xEnd, float y, GridLinePattern LinePattern,
|
||||||
GridLinePattern startToLeft, GridLinePattern startToRight, GridLinePattern startAhead,
|
GridLinePattern startToLeft, GridLinePattern startToRight, GridLinePattern startAhead,
|
||||||
GridLinePattern endToLeft, GridLinePattern endToRight, GridLinePattern endAhead)
|
GridLinePattern endToLeft, GridLinePattern endToRight, GridLinePattern endAhead)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user