From 7d0f3b1c8b1f6bb7fc7c2721c35bef5fb5a300a4 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 8 Jun 2018 17:57:42 +0000 Subject: [PATCH] B2018-085 -Table Scrunching Change - Make line-spacing match edit window more closely. Also, allow line-spacing to be adjusted to fit table on the current page if possible and if it is the last table of a step. B2018-090 - Changed Table Too Big error log message to be more useful. --- PROMS/Volian.Print.Library/vlnParagraph.cs | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 525cf987..37a8c317 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -897,16 +897,26 @@ namespace Volian.Print.Library float heightBefore = MyGrid.Height + 4 * MyPageHelper.YMultiplier; // B2018-033 Account for bottom continue message when seeing if a scrunched table will fit float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); + // B2018-085 Ignore the bottom continue message if the Table is the last part of the step. + if(ySizeBtmCtnMess > 0 && MyParent.MyItemInfo.IsHigh && YBottomMost == MyParent.YBottomMost) ySizeBtmCtnMess = 0; if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase1) && heightBefore > (yLocation - (yBottomMargin + ySizeBtmCtnMess))) { //MyGrid.TooBig = (MyItemInfo.MyDocStyle.Layout.FooterLength ?? 0) + SixLinesPerInch + MyGrid.Height - (yLocation - yBottomMargin); MyGrid.TooBig = SixLinesPerInch + MyGrid.Height * MyPageHelper.YMultiplier - (yLocation - yBottomMargin - ySizeBtmCtnMess); float heightAfter = MyGrid.Height + 4 * MyPageHelper.YMultiplier; MyPageHelper.TableAdjustment += (heightBefore - heightAfter); - if (heightAfter < (yLocation - yBottomMargin)) + if (heightAfter < (yLocation - yBottomMargin - ySizeBtmCtnMess)) { - _MyLog.ErrorFormat("<<< WARNING >>> Table is too big to fit on page, Vertical Padding adjusted to fit\r\n==>'Table Adjusted',{0},'{1}','{2}',{3},{4},{5}" - , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin)); + // B2018-081 - Removed error log message if the code was able to properly adjust the table + //_MyLog.WarnFormat("\r\n==> Table is too big to fit on page, Vertical Padding adjusted to fit in\r\n" + + // " [{0}] {1}\r\n" + + // " in {2}\r\n" + + // " Height Before={3:N2} Height After={4:N2} SpaceAvailable={5:N2}\r\n" + + // " No action necessary", + // MyItemInfo.ItemID,_MyItemInfo.ShortPath, + // _MyItemInfo.SearchDVPath.Replace("\a", "/"), heightBefore / 72, MyGrid.Height / 72, (yTopMargin - yBottomMargin) / 72); + //_MyLog.ErrorFormat("<<< WARNING >>> Table is too big to fit on page, Vertical Padding adjusted to fit\r\n==>'Table Adjusted',{0},'{1}','{2}',{3},{4},{5}" + // , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin)); } else MyGrid.IsTooBig = true; @@ -928,8 +938,16 @@ namespace Volian.Print.Library float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); if (MyGrid.Height > (yTopMargin - yBottomMargin)) { - _MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4},{5}" // RHM20150429 - Table Scrunch - , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin)); + // B2018-081 Changed the Error Log Message to be more useful when a table is too big. + _MyLog.ErrorFormat("\r\n==> Table is too big to fit on page, expect pagination problems in\r\n" + + " [{0}] {1}\r\n" + + " in {2}\r\n" + + " Height Before={3:N2} Height After={4:N2} SpaceAvailable={5:N2}\r\n" + + " ACTION REQUIRED: Table should be restructured or split over multiple pages", + MyItemInfo.ItemID, _MyItemInfo.ShortPath, + _MyItemInfo.SearchDVPath.Replace("\a", "/"), heightBefore/72, MyGrid.Height/72, (yTopMargin - yBottomMargin)/72); + //_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4},{5}" // RHM20150429 - Table Scrunch + // , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin)); } return retval; } @@ -2824,7 +2842,6 @@ namespace Volian.Print.Library // msg_yLocation accounts for extra lines in message from docstyle; and BottomContent is the actual // location of the last line of text on page. msg_yLocation = msg_yLocation + ((float)(MyPageHelper.BottomContent??0) - (SixLinesPerInch * MyPageHelper.YMultiplier)); // B2018-080 null reference check added - float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation) { // Adjusted Continue Message Y Offset //DebugPagination.WriteLine("====>> {0},'{1}'", msg_yLocation, MyItemInfo.ShortPath);