diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 5ee3a43e..0fb977de 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -60,6 +60,9 @@ namespace Volian.Print.Library } float mySize = YSize * MyPageHelper.YMultiplier; vlnParagraph firstChild = ChildrenBelow.Count > 0 ? ChildrenBelow[0] : null; + // Steps that have the smart template (the WCNCKL format for example), always include two children. + if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate && ChildrenBelow.Count > 1) + firstChild = ChildrenBelow[1]; float ySizeIncludingFirst = firstChild == null ? YSize : firstChild.YSize + (firstChild.YTopMost - YTopMost); bool KeepStepsOnPage = MyItemInfo.ActiveFormat.MyStepSectionLayoutData.KeepStepsOnPage; if (MyItemInfo.IsStepSection) @@ -164,7 +167,7 @@ namespace Volian.Print.Library //Console.WriteLine("'7LPI',{0},{1}", MyItemInfo.DBSequence, YSize); return 3; // High Level Step can fit at SevenLinesPerInch } - else // The entire step cannot fit on a blank page. + else // The entire step cannot fit on a blank page or KeepStepsOnPage is true. { // if there is more than half a page left, then start to print on the current page float myFirstPieceSize = GetFirstPieceSize(); //Case 0 @@ -179,10 +182,11 @@ namespace Volian.Print.Library ShowPageBreak(8, "First HLS has to split on current page", firstStep, YSize, yPageSize, yWithinMargins, ManualPageBreak); else ShowPageBreak(6, "HLS will have to split on current page", "Special", YSize, yPageSize, yWithinMargins, ManualPageBreak); - //BuildPageBreakList(yWithinMargins+SixLinesPerInch,yPageSize-2*SixLinesPerInch); // Determine items where page break(s) occur - //BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSize); // Case 5 - Determine items where page break(s) occur - // Pagination Fix Break1LineShort3a - BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSize + yExtra2,KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur + // if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because + // that makes pagination work incorrectly because the Smart Template has a 'table' line after the + // text. + BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur + //BuildPageBreakList(yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate?0:SixLinesPerInch), yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur return 0; // Stay on this page }