diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index f61837b1..f8ab2297 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -1639,15 +1639,35 @@ namespace Volian.Print.Library //} public float TableSpaceAvailable// RHM20150525 - Table Scrunch { - get + get // B2019-111 Keep AER Table with parent when RNO extends passt the end of the page. { - float retval = 0; - if(_ChildrenBelow!= null) + float tsa = 0; + float tsaRight = 0; + float btm = YBottom; + float btmRight = 0; + if (_ChildrenRight != null && _ChildrenRight.Count > 0) + { + tsaRight = _ChildrenRight[0].TableSpaceAvailable; + btmRight = _ChildrenRight[0].YBottomPagination; + } + if (_ChildrenBelow != null && _ChildrenBelow.Count > 0) + { foreach (vlnParagraph pgh in _ChildrenBelow) - retval = pgh.TableSpaceAvailable; + tsa = pgh.TableSpaceAvailable; + vlnParagraph pLast = ChildrenBelow[ChildrenBelow.Count - 1]; + btm = pLast.YBottomPagination; + //if(MyItemInfo.InList(559839)) + // Console.WriteLine("Here"); + } if (MyGrid != null) - retval = MyGrid.SpaceAvailable + MyGrid.LeadingSpaceAvailable; - return retval; + tsa = MyGrid.SpaceAvailable + MyGrid.LeadingSpaceAvailable; + if (btmRight != 0) + { + //_MyLog.WarnFormat("Item={00}, B={1} BR={2} T={3} TR={4}",MyItemInfo.ItemID , btm, btmRight, tsa, tsaRight); + if (btm < btmRight) + tsa = tsaRight; + } + return tsa; } } } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 20406783..863125ef 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -957,11 +957,11 @@ namespace Volian.Print.Library if ((MyGrid.Height + 4)* MyPageHelper.YMultiplier > (yLocation - yBottomMargin - ySizeBtmCtnMess)) { // B2018-081 Changed the Error Log Message to be more useful when a table is too big. - _MyLog.ErrorFormat("\r\n==> Table is too big to fit on page, expect pagination problems in\r\n" + - " [{0}] {1}\r\n" + - " in {2}\r\n" + - " Height Before={3:N2} Height After={4:N2} SpaceAvailable={5:N2}\r\n" + - " ACTION REQUIRED: Table should be restructured or split over multiple pages", + _MyLog.ErrorFormat("\r\n===> Table is too big to fit on page, expect pagination problems in\r\n" + + " 1> Item [{0}] {1}\r\n" + + " 2> in {2}\r\n" + + " 3> Height Before={3:N2} Height After={4:N2} SpaceAvailable={5:N2}\r\n" + + " 4> ACTION REQUIRED: Table should be restructured or split over multiple pages", MyItemInfo.ItemID, _MyItemInfo.ShortPath, _MyItemInfo.SearchDVPath.Replace("\a", "/"), heightBefore/72, MyGrid.Height/72, (yTopMargin - yBottomMargin)/72); //_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4},{5}" // RHM20150429 - Table Scrunch @@ -1579,7 +1579,7 @@ namespace Volian.Print.Library if (DebugText.IsOpen) DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost); int profileDepth1 = ProfileTimer.Push(">>>> vlnParagraph.Paginate"); - int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); + int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); ProfileTimer.Pop(profileDepth1); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set @@ -2964,29 +2964,53 @@ namespace Volian.Print.Library float retval = YTopMost; // Find any items remaining in MyPageHelper.MyParagraphs that should be printed on this page. vlnParagraphs process = new vlnParagraphs(null); + int processed = 0; foreach (vlnParagraph vPara in MyPageHelper.MyParagraphs.Values) { - if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost)) - // B2019-028: Added check for active section in next line so that following section text doesn't overlap or start too far down on page for case where there is a subsection - // with subsections of type Step/Word/Step - //if (vPara.MyItemInfo.ActiveSection.ItemID == this.MyItemInfo.ActiveSection.ItemID && (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)) // 20150701 Complicated RNO change - if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // B2019-077: 2.0 SCOPE empty section not printing for WES (revert to previous code line versus above) - process.Add(vPara); - else // 20150701 Complicated RNO change - _MyLog.WarnFormat("Less Than: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - else if (!vPara.Processed && ((vPara.YOffset + vPara.Height) == YTopMost)) - // B2019-028: see above comment (same check was added) - //if (vPara.MyItemInfo.ActiveSection.ItemID == this.MyItemInfo.ActiveSection.ItemID && (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)) // RHM20150507 Table Scrunch - if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // B2019-077: see above + if (!vPara.Processed) + { + if (vPara.MyItemInfo.IsTable && (vPara.YOffset <= YTopMost) && vPara.MyItemInfo.ActiveSection.ColumnMode > 0) { - process.Add(vPara); - _MyLog.WarnFormat("New AerRno PageBreak Logic: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); + _MyLog.WarnFormat("\r\n=-=-=> Table Print on First Page {0} {1} ColumnMode = {2}", vPara.MyItemInfo.ItemID, vPara.MyItemInfo.ShortPath, vPara.MyItemInfo.ActiveSection.ColumnMode); + if (vPara.MyItemInfo.ActiveSection.ColumnMode > 0) + process.Add(vPara); } - else // RHM20150507 Table Scrunch - _MyLog.WarnFormat("Equal: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - else if (!vPara.Processed && ((vPara.YOffset) < YTopMost)) - retval = Math.Min(retval, vPara.YTopMost); + else if (((vPara.YOffset + vPara.Height) < YTopMost)) + { + // B2019-028: Added check for active section in next line so that following section text doesn't overlap or start too far down on page for case where there is a subsection + // with subsections of type Step/Word/Step + //if (vPara.MyItemInfo.ActiveSection.ItemID == this.MyItemInfo.ActiveSection.ItemID && (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)) // 20150701 Complicated RNO change + if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) + { + // B2019-077: 2.0 SCOPE empty section not printing for WES (revert to previous code line versus above) + process.Add(vPara); + } + else // 20150701 Complicated RNO change + _MyLog.WarnFormat("Less Than: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); + } + else if (((vPara.YOffset + vPara.Height) == YTopMost)) + { + + // B2019-028: see above comment (same check was added) + //if (vPara.MyItemInfo.ActiveSection.ItemID == this.MyItemInfo.ActiveSection.ItemID && (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)) // RHM20150507 Table Scrunch + if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // B2019-077: see above + { + process.Add(vPara); + _MyLog.WarnFormat("New AerRno PageBreak Logic: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); + } + else // RHM20150507 Table Scrunch + _MyLog.WarnFormat("Equal: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); + } + else if (((vPara.YOffset) < YTopMost)) + { + retval = Math.Min(retval, vPara.YTopMost); + } + } + else + processed++; } + //Console.WriteLine("~~~ {0} has {1} Steps {2} Processed {3} to Process", MyItemInfo.ShortPath, MyPageHelper.MyParagraphs.Count + // , processed,process.Count); foreach (vlnParagraph vPara in process) { vPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); @@ -3293,9 +3317,10 @@ namespace Volian.Print.Library MyTopRNO = MyParent.MyTopRNO; if (MyTopRNO != null) MyTopRNO.LastRNO = this; } - - if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID) && !itemInfo.IsFootnote) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); - + if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID) && !itemInfo.IsFootnote) + { + MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); + } // if this a continuous subsection, refresh the style. // This was commented out to fix a Westinghouse print issue 3-21-2014, orignally put in for Farley //if (itemInfo.IsStepSection && !(itemInfo as SectionInfo).IsSeparatePagination() && itemInfo.MyParent.IsSection) @@ -4267,6 +4292,7 @@ namespace Volian.Print.Library if (rnoAfter) if (loadChildren) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); + YBottomPagination = yoff;// B2019-111 Exclude Right for Pagination yoff = Math.Max(yoff, yOffRight); // TODO - use RNOSepAfterAER flag too: string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString; @@ -5400,7 +5426,16 @@ namespace Volian.Print.Library public float YBottomMost { get { return _YBottomMost; } - set { _YBottomMost = value; } + set + { + _YBottomMost = value; + } + } + private float _YBottomPagination; // B2019-111 Keep table with Parent + protected float YBottomPagination + { + get { return _YBottomPagination; } + set { _YBottomPagination = value; } } protected float _YBottomMostAdjust = 0; // the RNO separator is outside asterisk box, account for additional Y space public float YBottomMostAdjust