diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index 65707ae2..30701802 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -1237,6 +1237,9 @@ namespace Volian.Controls.Library void _tableCellEditor_HeightChanged(object sender, EventArgs args) { + // B2022-028: images in table cells - don't come into this code if it is an image in a table cell: + if (_tableCellEditor is StepRTB && (_tableCellEditor as StepRTB).ImageWidth > 0) return; + if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return; int curHeight = GetCellHeight(Row, Col);//(Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height; CellRange cr = GetMergedRange(Row, Col); @@ -1268,10 +1271,6 @@ namespace Volian.Controls.Library AdjustGridControlSize(); } } - if (_tableCellEditor is StepRTB && (_tableCellEditor as StepRTB).ImageWidth > 0) - { - Width = Cols[0].Width = (_tableCellEditor as StepRTB).ImageWidth; - } } void VlnFlexGrid_KeyUp(object sender, KeyEventArgs e) { @@ -1395,7 +1394,7 @@ namespace Volian.Controls.Library case TextAlignEnum.GeneralCenter: case TextAlignEnum.LeftCenter: case TextAlignEnum.RightCenter: - hAdjust = hDiff / 2; + hAdjust = hDiff / 2; //0; // hDiff / 2; break; default: break; diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index 51ecec9a..b0cc7851 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -1484,7 +1484,7 @@ public string Path ShadingToPdf(myColumnText, left, top, x, w, y, h); // C2021-004 Table Cell Shading return; } - BordersToPdf(myColumnText, left, top, x, w, y, h ); + BordersToPdf(myColumnText, left, top, x, w, y, h ,false); float hAdjust = VeritcalTextAlignment(h,_MyPageHelper.YMultiplier); iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas); float adjustTextLocation = mult * 4; // RHM 20120925 Move text down about 1 half line from the border @@ -1529,11 +1529,15 @@ public string Path { if(obj is iTextSharp.text.Image) { + // B2022-028: Insert image into grid & print. Print was accounting for multiple rows in table where + // inserted image was not in first row (mod setabsoluteposition to account for location in table). + // Also, borders were no longer visible so draw those back in (added call to BordersToPdf) iTextSharp.text.Image img = obj as iTextSharp.text.Image; - img.SetAbsolutePosition(left,top-h); + img.SetAbsolutePosition(left + x, top - y - h); img.ScaleAbsoluteWidth(w); img.ScaleAbsoluteHeight(h); myColumnText.Canvas.AddImage(img); + BordersToPdf(myColumnText, left, top, x, w, y, h, true); } } float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch @@ -1638,7 +1642,7 @@ public string Path #region Private Border Methods // coordinate system is upside down of screen. 0,0 on screen is top/left. 0,0 on pdf is bottom/left. // i.e. x is same, y is flipped. - private void BordersToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, float x, float w, float y, float h) + private void BordersToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, float x, float w, float y, float h, bool doTop) { PdfContentByte cb = myColumnText.Canvas; cb.SaveState();// Save state before drawing borders @@ -1649,10 +1653,11 @@ public string Path float yBottom = top - y - h + YOffset; // ZoomToCell(myColumnText, xLeft, yTop, xRight, yBottom); // Draw Top Side for the first row - if (r1 == 0) + // B2022-028: Insert image into grid & print. The top/left was no longer visible if an image is in a grid cell, redraw it + if (r1 == 0 || doTop) DrawHorizontalLine(cb, "Top", xLeft, xRight, yTop, TopSide, LeftSide, AboveLeftSide, LeftOfTopSide, AboveRightSide, RightSide, RightOfTopSide); // Draw Left Side for the first column - if (c1 == 0) + if (c1 == 0 || doTop) DrawLineVertical(cb, "Left", xLeft, yBottom, yTop, LeftSide, BottomSide, LeftOfBottomSide, BelowLeftSide, LeftOfTopSide, TopSide, AboveLeftSide); // Draw Bottom Side DrawHorizontalLine(cb, "Bottom", xLeft, xRight, yBottom, BottomSide, BelowLeftSide, LeftSide, LeftOfBottomSide, RightSide, BelowRightSide, RightOfBottomSide);