diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index af77c46c..3f4bfcfa 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -468,6 +468,16 @@ namespace Volian.Print.Library float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); float ySizeBtmEndMess1 = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); + // B2017-154 Don't leave an orphan on the next page if the high level step and first sub-step will fit on the current page + if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.NoOrphans1 && KeepStepsOnPage && ChildrenBelow.Count == 2)// Handle Orphans when there are two sub-steps and only one will fit. + { + vlnParagraph orphan = ChildrenBelow[1];// Verify that the orphan has no children + if (orphan.ChildrenBelow.Count == 0 && orphan.ChildrenAbove.Count == 0 && orphan.ChildrenLeft.Count == 0 && orphan.ChildrenRight.Count == 0) + { + //_MyLog.WarnFormat("Orphan Found {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); + KeepStepsOnPage = false; + } + } 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 {