diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 3f4efc2c..eca4444d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -798,6 +798,7 @@ namespace VEPROMS.CSLA.Library // force Print of MS Word Attachment to Final without revisions and comments myDoc.ActiveWindow.View.ShowRevisionsAndComments = false; myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal; + int lastStart = sel.Start; while (sel != null) { if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount)); @@ -935,6 +936,11 @@ namespace VEPROMS.CSLA.Library InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper); } sel = FindRO(); + if (sel != null && sel.Start == lastStart) + { + Console.WriteLine("Seems to be repeating find of ro that is not an ro: " + sel.Text); + sel = null; + } } if (statusChange != null) statusChange(VolianStatusType.Update, 0, "Creating PDF"); sel = MyApp.Selection; @@ -1281,8 +1287,8 @@ namespace VEPROMS.CSLA.Library { if (roValue == null) { - //sel.Text = "RO Not Found"; - //sel.Font.Color = LBWdColor.wdColorRed; + sel.Text = "RO Not Found"; + sel.Font.Color = LBWdColor.wdColorRed; } else { diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index a033120d..cbc777e8 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -171,23 +171,24 @@ namespace Volian.Print.Library if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild) KeepStepsOnPage = false; if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false; - float ySectionEndMsg = !_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1 && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0; - if (ySizeIncludingFirstStep < yWithinMargins && ySizeIncludingFirst > yWithinMargins && yWithinMargins > (yPageSize/2)) + float ySectionEndMsg = !_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1 && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0; + if (ySizeIncludingFirstStep < yWithinMargins && ySizeIncludingFirst > yWithinMargins && yWithinMargins > (yPageSize / 2)) ySizeIncludingFirst = ySizeIncludingFirstStep; if (!KeepStepsOnPage && (ySizeIncludingFirst + ySectionEndMsg) > (yLocation - yBottomMargin) && !nearTheTop) { - ShowPageBreak(4, "Page Break Before Continuous Step Section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 1; - } - else - { - if (ChildrenBelow.Count > 0) + if (!MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert || + (ySizeIncludingFirst < yPageSize || yWithinMargins < (yPageSize - (2 * 72)))) { - vlnParagraph firstHLS = ChildrenBelow[0]; - if (firstHLS.MyItemInfo.IsHigh) - firstHLS.BreakHighLevelStepWithSection = true; + ShowPageBreak(4, "Page Break Before Continuous Step Section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); + return 1; } } + if (ChildrenBelow.Count > 0) + { + vlnParagraph firstHLS = ChildrenBelow[0]; + if (firstHLS.MyItemInfo.IsHigh) + firstHLS.BreakHighLevelStepWithSection = true; + } } return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page }