If a blank paragraph is followed by a large table and both will not fit on a page, but the table will fit by itself, move the break directl in front of the table.
This commit is contained in:
parent
6d94bfb5f4
commit
0477c09d03
@ -172,7 +172,7 @@ namespace Volian.Print.Library
|
||||
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))
|
||||
if (ySizeIncludingFirstStep < yWithinMargins && ySizeIncludingFirst > yWithinMargins && yWithinMargins > (yPageSize/2))
|
||||
ySizeIncludingFirst = ySizeIncludingFirstStep;
|
||||
if (!KeepStepsOnPage && (ySizeIncludingFirst + ySectionEndMsg) > (yLocation - yBottomMargin) && !nearTheTop)
|
||||
{
|
||||
@ -816,6 +816,8 @@ namespace Volian.Print.Library
|
||||
// yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc
|
||||
//float yTopNew = paraBreak.YVeryTop - YTopMost;
|
||||
//float yTopNew = paraBreak.YTopMost - YTopMost;
|
||||
if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg)))
|
||||
paraBreak = paraBreak.ChildrenBelow[0];
|
||||
float yTopNew = Math.Min(paraBreak.YTopMost, paraBreak.YVeryTop) - YTopMost;
|
||||
|
||||
// This is for formats that break on all HLS, Cautions & Notes (often backgrounds):
|
||||
@ -857,6 +859,21 @@ namespace Volian.Print.Library
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
|
||||
private bool JustATableThatWillFit(vlnParagraph paraBreak, float ypagesize)
|
||||
{
|
||||
if (paraBreak.MyItemInfo.MyContent.Text.Replace(" ", "").Replace(@"\u160?", "").Replace(@"\'A0", "") != "") return false;
|
||||
if (paraBreak.YSize < ypagesize) return false;
|
||||
if (paraBreak.ChildrenAbove.Count > 0) return false;
|
||||
if (paraBreak.ChildrenLeft.Count > 0) return false;
|
||||
if (paraBreak.ChildrenRight.Count > 0) return false;
|
||||
if (paraBreak.ChildrenBelow.Count != 1) return false;
|
||||
if (!paraBreak.ChildrenBelow[0].MyItemInfo.IsTable) return false;
|
||||
vlnParagraph paraTable = paraBreak.ChildrenBelow[0];
|
||||
if (paraTable.YSize < ypagesize)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Finds the highest StepLevel (lowest StepLevel number, 0 = HLS, 1 = first substep) that
|
||||
/// fills the page sufficiently (more than half-full)
|
||||
|
Loading…
x
Reference in New Issue
Block a user