diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 11a82fbc..cab5af92 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -500,6 +500,18 @@ namespace Volian.Print.Library } if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) // only do the following for Calvert Alarms { + // Or Step whose parent fits on a page should break at the parent step + //if (MyItemInfo.InList(40308)) Console.WriteLine("here"); + //if (paraBreak.MyItemInfo.InList(40339)) + float ySpaceOnNextPage = yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace; + if (paraBreak.MyItemInfo.IsOr && paraBreak.MyParent.YSize < ySpaceOnNextPage) + { + vlnParagraph paraBreakParent = paraBreak.MyParent; + while (paraBreakParent.MyParent.YSize < ySpaceOnNextPage) + paraBreakParent = paraBreakParent.MyParent; + //_MyLog.WarnFormat("Or Step PageBreak '{0}','{1}','{2}'",paraBreak.MyItemInfo.ShortPath ,paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyItemInfo.MyHLS.DisplayText); + paraBreak = paraBreakParent; + } if (!paraBreak.ParentHasCalvertMacro) { foreach (int lev in myList.Keys) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index ab01b1c0..c8dba4e3 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -376,6 +376,12 @@ namespace Volian.Print.Library public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { + //if(PartsAbove.Count > 0 && PartsAbove[0] is vlnHeader) + // if (PartsLeft.Count > 0 && PartsLeft[0] is vlnTab) + // //if((PartsLeft[0] as vlnTab).Text[0] != '\u25CF') + // _MyLog.WarnFormat("NoteTab '{0}','{1}','{2}','{3}','{4}','{5}','{6}'", (PartsAbove[0] as vlnHeader).Text, (PartsLeft[0] as vlnTab).Text, MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.MyHLS.DisplayText, + // MyItemInfo.ShortPath, MyItemInfo.FormatStepData.TabData.IdentPrint, MyItemInfo.FormatStepData.TabData.IdentEdit); +// if (MyItemInfo.PageNumber == 0) MyItemInfo.PageNumber = MyPageHelper.CurrentPageNumber; else if (MyItemInfo.PageNumberUsed != 0 && MyItemInfo.PageNumberUsed != MyPageHelper.CurrentPageNumber) { @@ -908,8 +914,14 @@ namespace Volian.Print.Library // remove the macro so that the header macro doesn't print on the page with the note (without this, an extraneous // header for the 'table'is printed. if (PartsLeft.Count != 0 && (PartsLeft[0] is vlnMacro) && MyPageHelper.ParaBreaks.Count != 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.MyPrevious == null) - if (!MyPageHelper.ParaBreaks[0].MyItemInfo.IsNote && !MyPageHelper.ParaBreaks[0].MyItemInfo.IsCaution) PartsLeft.Clear(); - + if (!MyPageHelper.ParaBreaks[0].MyItemInfo.IsNote && !MyPageHelper.ParaBreaks[0].MyItemInfo.IsCaution) + { + // Only clear the header if it is the first child below + if (ChildrenBelow[0].MyItemInfo.ItemID == MyPageHelper.ParaBreaks[0].MyItemInfo.ItemID) + PartsLeft.Clear(); + //else + // _MyLog.WarnFormat("Would Have Cleared PageHeader '{0}','{1}'", MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.MyHLS.DisplayText); + } if (IsWordDocPara) { PdfReader tmp = null;