From 48b677486e8f2d70a6150f93e7a45af4b5507b81 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 14 Apr 2011 14:03:08 +0000 Subject: [PATCH] --- .../Volian.Print.Library/VlnSvgPageHelper.cs | 4 +++ PROMS/Volian.Print.Library/vlnParagraph.cs | 33 +++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 0920b778..d21e824b 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -636,8 +636,12 @@ namespace Volian.Print.Library case "{OF}": // Total Page Count for this section return CurrentPageOf.ToString(); case "{REVDATE}": // Revision Date + if (RevDate == null || RevDate == "") return DateTime.Now.ToShortDateString(); return RevDate; case "{REV}": // Revision Number + // 16-bit had very specific code to check for first character + // == to a ' ' (space) and if so, start Rev from second character. + if (Rev !=null && Rev != "" && Rev[0] == ' ') return Rev.Substring(1, Rev.Length - 1); return Rev; } if (!_MissingTokens.Contains(match.Value)) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 45fa9d2f..f7d152dd 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -168,7 +168,9 @@ namespace Volian.Print.Library Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); //Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); float retval = yLocation; - if (MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height<(1.01F*IParagraph.Leading)) + // Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2 + // multiplier accounts for both. + if (MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height < (1.2F * IParagraph.Leading)) IParagraph.Alignment = Element.ALIGN_CENTER; retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugText, yBottomMargin); if (retval == 0) // problem occurred - paragraph was not able to be printed on page @@ -326,6 +328,7 @@ namespace Volian.Print.Library //if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop); yTopMost = Math.Min(yTopMost,YVeryTop); yPageStart = yTopMargin + yTopMost - 2 * SixLinesPerInch; + if (EmptyTopMostPart) yPageStart += SixLinesPerInch; myMsg = docstyle.Continue.Top.Message; if (myMsg != null && myMsg != "") { @@ -373,7 +376,28 @@ namespace Volian.Print.Library } return yPageStart; } - + private vlnParagraph TopMostChild + { + get + { + if (ChildrenAbove.Count>0) return ChildrenAbove[0].TopMostChild; + return this; + } + } + private bool EmptyTopMostPart + { + get + { + if (TopMostChild.PartsAbove.Count == 0) return false; + foreach (vlnPrintObject po in TopMostChild.PartsAbove) + { + vlnHeader hd = po as vlnHeader; + if (hd == null) return false; + if (hd.Text != "") return false; + } + return true; + } + } private void OutputOtherPageSteps(PdfContentByte cb, float YTopMost, float yPageStart, float yTopMargin, float yBottomMargin) { // Find any items remaining in MyPageHelper.MyParagraphs that should be printed on this page. @@ -1063,15 +1087,10 @@ namespace Volian.Print.Library if (bx.TabPos > 0) xoff += (float)bx.TabPos; // xoff starts as left margin else - { xoff += (float)((bx.TxtStart + XOffsetBox + (bx.TxtWidth / 2)) - (hdrWidth / 2)); // xoff starts as left margin - } } else if (formatInfo.MyStepSectionLayoutData.Separator.Location > 0) - { - // if there is a separator location, use it - 16bit code used the separator location as a divisor: xoff = XOffset + AdjustToCharPosition((float)((para.Width - hdrWidth) / formatInfo.MyStepSectionLayoutData.Separator.Location)); - } else xoff = XOffset + (para.Width / 2) + (hdrWidth / 2); // XOffset has left margin included }