Changed an Error Message to provide the location where the error occured.
Added logic to keep un-numbered child steps together. Changed the space on the first page to be yWithinMargins. Changed an Error Message to provide the location where the error occured. Changed the format of the Pagination Debug file to make comparison easier. Used YTopMost to correctly determine how much space is left on a page. Changed an Error Message to provide the location where the error occured. Changed logic to keep from breaking in a caution or a note.
This commit is contained in:
parent
dbf3129866
commit
11fe928774
@ -199,7 +199,14 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
if (_MyItemInfo != null)
|
||||||
|
{
|
||||||
|
_MyLog.ErrorFormat("<<< ERROR >>> Error doing DoROAdjustments\r\n==>'RO Adjustments Error',{0},'{1}','{2}','{3}'"
|
||||||
|
, _MyItemInfo.ItemID, _MyItemInfo.MyDocVersion.MyFolder.Name, _MyItemInfo.ShortPath, ex.Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
_MyLog.Error("DisplayText.CreateRTF Error doing DoROAdjustments", ex);
|
_MyLog.Error("DisplayText.CreateRTF Error doing DoROAdjustments", ex);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if in print mode, view mode, or non-active richtextbox do replace words. Only if in
|
// if in print mode, view mode, or non-active richtextbox do replace words. Only if in
|
||||||
|
@ -72,6 +72,8 @@ namespace Volian.Print.Library
|
|||||||
// Steps that have the smart template (the WCNCKL format for example), always include two children.
|
// Steps that have the smart template (the WCNCKL format for example), always include two children.
|
||||||
if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate && ChildrenBelow.Count > 1)
|
if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate && ChildrenBelow.Count > 1)
|
||||||
firstChild = ChildrenBelow[1];
|
firstChild = ChildrenBelow[1];
|
||||||
|
if (firstChild != null && !firstChild.MyItemInfo.IsNumbered) // If not numbered get the last child
|
||||||
|
firstChild = firstChild.MyParent.ChildrenBelow[firstChild.MyParent.ChildrenBelow.Count - 1];
|
||||||
float ySizeIncludingFirst = firstChild == null ? YSize : firstChild.YSize + (firstChild.YTopMost - YTopMost);
|
float ySizeIncludingFirst = firstChild == null ? YSize : firstChild.YSize + (firstChild.YTopMost - YTopMost);
|
||||||
bool KeepStepsOnPage = MyItemInfo.ActiveFormat.MyStepSectionLayoutData.KeepStepsOnPage;
|
bool KeepStepsOnPage = MyItemInfo.ActiveFormat.MyStepSectionLayoutData.KeepStepsOnPage;
|
||||||
if (MyItemInfo.IsStepSection)
|
if (MyItemInfo.IsStepSection)
|
||||||
@ -108,7 +110,18 @@ namespace Volian.Print.Library
|
|||||||
//if (ySizeIncludingFirst > (yLocation - yBottomMargin) && ySizeIncludingFirst < yPageSize)
|
//if (ySizeIncludingFirst > (yLocation - yBottomMargin) && ySizeIncludingFirst < yPageSize)
|
||||||
vlnParagraph firstStepChild = firstChild;
|
vlnParagraph firstStepChild = firstChild;
|
||||||
//while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0];
|
//while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0];
|
||||||
while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh)) firstStepChild = firstStepChild.ChildrenBelow[0];
|
if(firstStepChild.MyItemInfo.IsNumbered)
|
||||||
|
while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh))
|
||||||
|
{
|
||||||
|
firstStepChild = firstStepChild.ChildrenBelow[0];
|
||||||
|
if (!firstStepChild.MyItemInfo.IsNumbered)
|
||||||
|
{
|
||||||
|
firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count-1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count-1];
|
||||||
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
|
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
|
||||||
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > yWithinMargins;
|
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > yWithinMargins;
|
||||||
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
|
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
|
||||||
@ -192,15 +205,19 @@ namespace Volian.Print.Library
|
|||||||
// yPageSize is space on next page. This may be different if the format flag 'UseOnAllButFirst' is
|
// yPageSize is space on next page. This may be different if the format flag 'UseOnAllButFirst' is
|
||||||
// set.
|
// set.
|
||||||
// yWithinMargins is space available on current page.
|
// yWithinMargins is space available on current page.
|
||||||
if(firstStep == "Yes")
|
|
||||||
ShowPageBreak(8, "First HLS has to split on current page", firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
|
||||||
else
|
|
||||||
ShowPageBreak(6, "HLS will have to split on current page", "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
|
||||||
// if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because
|
// if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because
|
||||||
// that makes pagination work incorrectly because the Smart Template has a 'table' line after the
|
// that makes pagination work incorrectly because the Smart Template has a 'table' line after the
|
||||||
// text.
|
// text.
|
||||||
|
float ySpaceOnFirstPage = yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate ? 0 : SixLinesPerInch);
|
||||||
|
if (firstStep == "Yes")
|
||||||
|
{
|
||||||
|
ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line
|
||||||
|
ShowPageBreak(8, "First HLS has to split on current page", firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ShowPageBreak(6, "HLS will have to split on current page", "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||||
//BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
//BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||||
BuildPageBreakList(yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate?0:SixLinesPerInch), yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
BuildPageBreakList(ySpaceOnFirstPage, yPageSize + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||||
return 0; // Stay on this page
|
return 0; // Stay on this page
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +270,10 @@ namespace Volian.Print.Library
|
|||||||
yPageStart = yTopMargin + YVeryTop;
|
yPageStart = yTopMargin + YVeryTop;
|
||||||
yLocation = yPageStart - YOffset;
|
yLocation = yPageStart - YOffset;
|
||||||
//MyItemInfo.ItemID, YSize, yPageSize, yLocation
|
//MyItemInfo.ItemID, YSize, yPageSize, yLocation
|
||||||
DebugPagination.WriteLine("-1,'Yes','Forced Pagination',{0},{1},,{3},{4}", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.DBSequence);
|
//_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination - ItemID = {0}\r\nLocation = '{1}'", MyItemInfo.ItemID, MyItemInfo.ShortPath);
|
||||||
|
_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'"
|
||||||
|
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);
|
||||||
|
DebugPagination.WriteLine("------,'Yes','Forced Pagination',{0},{1},,{3},{4}", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.DBSequence);
|
||||||
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin);
|
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin);
|
||||||
}
|
}
|
||||||
private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins, bool manualPageBreak)
|
private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins, bool manualPageBreak)
|
||||||
@ -261,7 +281,7 @@ namespace Volian.Print.Library
|
|||||||
if (breakOrNot != "No")
|
if (breakOrNot != "No")
|
||||||
{
|
{
|
||||||
// DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
|
// DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
|
||||||
DebugPagination.WriteLine("{0},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}",
|
DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}",
|
||||||
MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1),
|
MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1),
|
||||||
MyItemInfo.ShortPath, instance,
|
MyItemInfo.ShortPath, instance,
|
||||||
(manualPageBreak ? "Manual " : "") + message, breakOrNot,
|
(manualPageBreak ? "Manual " : "") + message, breakOrNot,
|
||||||
@ -297,7 +317,7 @@ namespace Volian.Print.Library
|
|||||||
vlnParagraph paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList);
|
vlnParagraph paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList);
|
||||||
if (paraBreak == null) break;
|
if (paraBreak == null) break;
|
||||||
// yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc
|
// 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;
|
||||||
RemoveProcessedParagraphs(myList, yTopNew - yTop);
|
RemoveProcessedParagraphs(myList, yTopNew - yTop);
|
||||||
yTop = yTopNew;
|
yTop = yTopNew;
|
||||||
MyPageHelper.ParaBreaks.Add(paraBreak);
|
MyPageHelper.ParaBreaks.Add(paraBreak);
|
||||||
|
@ -453,7 +453,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
PrintTextMessage(cb, "No Proms Output", _TextLayer);
|
PrintTextMessage(cb, "No Proms Output", _TextLayer);
|
||||||
cb.PdfDocument.NewPage(); // only have 16bit pages left (for DebugMode)
|
cb.PdfDocument.NewPage(); // only have 16bit pages left (for DebugMode)
|
||||||
DebugPagination.WriteLine("{0},'{1}'",
|
DebugPagination.WriteLine("{0:D6},'{1}'",
|
||||||
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output");
|
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ namespace Volian.Print.Library
|
|||||||
float yoff = 0;
|
float yoff = 0;
|
||||||
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
||||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
|
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
|
||||||
DebugPagination.WriteLine("{0},'{1}',{2}",
|
DebugPagination.WriteLine("{0:D6},'{1}',{2}",
|
||||||
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -832,7 +832,7 @@ namespace Volian.Print.Library
|
|||||||
if (doimport2)
|
if (doimport2)
|
||||||
{
|
{
|
||||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0);
|
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0);
|
||||||
DebugPagination.WriteLine("{0},'{1}',{2}",
|
DebugPagination.WriteLine("{0:D6},'{1}',{2}",
|
||||||
myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1);
|
myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,10 @@ namespace Volian.Print.Library
|
|||||||
DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath,MyItemInfo.MyContent.Text,XOffset);
|
DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath,MyItemInfo.MyContent.Text,XOffset);
|
||||||
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
||||||
if (MyGrid.Height > (yTopMargin - yBottomMargin))
|
if (MyGrid.Height > (yTopMargin - yBottomMargin))
|
||||||
_MyLog.InfoFormat("\r\nTable is too big to fit on page, expect pagination problems. Table is in High Level Step {0}\r\n", MyItemInfo.MyHLS);
|
{
|
||||||
|
_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4}"
|
||||||
|
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, MyGrid.Height,(yTopMargin - yBottomMargin));
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2379,7 +2382,8 @@ namespace Volian.Print.Library
|
|||||||
int level = paraLoc.StepLevel;
|
int level = paraLoc.StepLevel;
|
||||||
if (KeepStepsOnPage && paraLoc.MyParagraph.MyItemInfo.MyContent.Type == 20001)
|
if (KeepStepsOnPage && paraLoc.MyParagraph.MyItemInfo.MyContent.Type == 20001)
|
||||||
{
|
{
|
||||||
if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null)
|
if (DontBreakHere(paraLoc))
|
||||||
|
//if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null) // First substep
|
||||||
level = 0;
|
level = 0;
|
||||||
else
|
else
|
||||||
level = 1;
|
level = 1;
|
||||||
@ -2388,6 +2392,19 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
return myList;
|
return myList;
|
||||||
}
|
}
|
||||||
|
private bool DontBreakHere(ParagraphLocation paraLoc)
|
||||||
|
{
|
||||||
|
if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null) // First substep
|
||||||
|
return true;
|
||||||
|
vlnParagraph myPara = paraLoc.MyParagraph;
|
||||||
|
while (!myPara.MyItemInfo.IsHigh)
|
||||||
|
{
|
||||||
|
if (myPara.MyItemInfo.IsCaution) return true;
|
||||||
|
if (myPara.MyItemInfo.IsNote) return true;
|
||||||
|
myPara = myPara.MyParent;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class ParagraphLocation
|
public class ParagraphLocation
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user