Add logic to determine if a section has one high level step and an end message to include the height of the end message when a section will not fit on a page.

When determining the Page Break location in a step, verify that the item before the page break will fit on the page
Add Error Log output if text is low on the page,
This commit is contained in:
John Jenko 2014-09-26 15:39:31 +00:00
parent eac2037172
commit 84f4153900
2 changed files with 20 additions and 1 deletions

View File

@ -160,7 +160,9 @@ namespace Volian.Print.Library
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > yWithinMargins;
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
KeepStepsOnPage = false;
if (!KeepStepsOnPage && ySizeIncludingFirst > (yLocation - yBottomMargin))
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 (!KeepStepsOnPage && ySizeIncludingFirst + ySectionEndMsg > (yLocation - yBottomMargin))
{
ShowPageBreak(4, "Page Break Before Continuous Step Section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 1;
@ -514,6 +516,7 @@ namespace Volian.Print.Library
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage-accountForCalvertAlarmConditionResponseFooter, yLowerLimit,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
float yLoc = ySpaceOnCurPage - (paraBreak.YOffset - (YTopMost + yTop));
//Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
//if (lastBreak != null && lastBreak.MyItemInfo.InList(80091, 1985))
// Console.WriteLine("After 80091 {0}",paraBreak.ToString());
@ -525,6 +528,21 @@ namespace Volian.Print.Library
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);
break;
}
if (yLoc <= 0) // Check where it would break if the space on the page was one line shorter
{
vlnParagraph paraBreak2 = FindPageBreak(yStart, ySpaceOnCurPage - (SixLinesPerInch + accountForCalvertAlarmConditionResponseFooter), yLowerLimit,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
if (paraBreak2 != null && paraBreak != paraBreak2)
{
yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height));
if (paraBreak.YOffset == paraBreak2.YOffset + paraBreak2.Height)
{
//_MyLog.WarnFormat("Fix Break when no blank line {0},{1},{2}", paraBreak2.MyItemInfo.ShortPath, paraBreak2.MyItemInfo.ItemID,yLoc);
paraBreak = paraBreak2;
}
}
}
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfcreekCKLFormat)
{
if (!paraBreak.MyItemInfo.IsHigh // not a high level step

View File

@ -780,6 +780,7 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + YVeryTop;
yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page.
}
if (yLocation - Height < 24) _MyLog.WarnFormat("Very Low {0},{1},{2},{3},{4},{5}",MyItemInfo.ShortPath,MyItemInfo.ItemID,yLocation,Height,yLocation-Height,yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin);
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed.