diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 2ed6ea26..8db938c8 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -197,7 +197,8 @@ namespace Volian.Print.Library firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1]; float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost); float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); - bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess); + float ySizeBtmEndMess = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); + bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess -ySizeBtmEndMess); if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild) KeepStepsOnPage = false; if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false; @@ -323,6 +324,13 @@ namespace Volian.Print.Library if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 && (MyItemInfo.RNOs==null ||MyItemInfo.RNOs.Count==0)) mySize += (2*SixLinesPerInch); + //// Account for extra lines in the end message (flag < 0) + float adjMsgY = 0; + if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. + { + adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch; + if (yEndMsg != 0) yEndMsg += adjMsgY; + } if (!ManualPageBreak && (mySize + yEndMsg <= yWithinMargins + yExtra) || // Don't Paginate if there is enough room, will fit on page (mySize <= yWithinMargins + yExtra && SpecialCaseForRobinson())) //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page @@ -406,7 +414,8 @@ namespace Volian.Print.Library if (_Match16BitPagination) mySize7LPI += SixLinesPerInch; float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); - if (KeepStepsOnPage && ySizeIncludingFirst > (yWithinMargins - ySizeBtmCtnMess1)) KeepStepsOnPage = false; + float ySizeBtmEndMess1 = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); + if (KeepStepsOnPage && ySizeIncludingFirst > (yWithinMargins - ySizeBtmCtnMess1 - ySizeBtmEndMess1)) KeepStepsOnPage = false; if (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg - tableSpaceAvailable <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break { // Don't want extra line before step @@ -539,6 +548,18 @@ namespace Volian.Print.Library //return 2; throw new Exception("PageBreak Logic Missing, vlnParagraph.cs"); } + private float GetBottomEndMessageSize(DocStyle docstyle) + { + float myBottomMsgSpace = 0; + if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. + { + docstyle = MyItemInfo.MyDocStyle; + string myBottomMsg = docstyle.End.Message; + myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; + if (myBottomMsg != null && docstyle.End.Flag < 0) myBottomMsgSpace += (-(float)docstyle.End.Flag * SixLinesPerInch); + } + return myBottomMsgSpace; + } private string CheckForFirstCompression(string reason) { if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep)