From 08f2a9f631267303427edb9fbbe2e56dd0b0e227 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 2 Oct 2014 13:13:20 +0000 Subject: [PATCH] Fixed logic so that if the high-level step has an end message and the end message would excede the bottom margin, then the step is placed on the next page. --- PROMS/Volian.Print.Library/Pagination.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 95c99971..fffe42c0 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -243,6 +243,12 @@ namespace Volian.Print.Library // ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); if (MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0) yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); + if (KeepStepsOnPage && YSize == ySizeIncludingFirst && YSize + yEndMsg > yWithinMargins) + { + // If the first step is the size of the entire step and the step has an end message then don't try to break the step + KeepStepsOnPage = false; + //_MyLog.WarnFormat("Kick Step to Next Page {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); + } if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break { // Don't want extra line before step @@ -506,6 +512,14 @@ namespace Volian.Print.Library ySpaceOnCurPage += SixLinesPerInch; accountForSmartTemplateHeader = Height - (2 * SixLinesPerInch); } + // This was added so that if a page break was immediately necessary the code would use the current step. + // However, a better solution was found and put in Paginate() + //if (YSize == Height + SixLinesPerInch && YSize + yEndMsg >= ySpaceOnCurPage) + //{ + // _MyLog.WarnFormat("Would have been unable to break {0},{1}",MyItemInfo.ItemID, MyItemInfo.ShortPath); + // MyPageHelper.ParaBreaks.Add(this); + // return; + //} while (((YSize - yTop) > (ySpaceOnCurPage - (accountForCalvertAlarmConditionResponseFooter+yEndMsg))) || PageBreakOnStepList.Count > 0) { float ySpaceOnCurPageSave = ySpaceOnCurPage;