diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 39ba5d75..936abe03 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -978,7 +978,7 @@ namespace Volian.Print.Library // get height - if two lines high, need width of 2nd line for adding // space characters - float heightTtl = vlnPrintObject.GetHeight(cb, myparagrapht, savTitleWid, false); + float heightTtl = vlnPrintObject.GetHeight(cb, myparagrapht, string.Empty, savTitleWid, false); string spaceStr = ""; float startSpace = 0; // the '6's in the next few code lines & in the 'while' loop below allows the placement of the dots (or other space character) diff --git a/PROMS/Volian.Print.Library/vlnBox.cs b/PROMS/Volian.Print.Library/vlnBox.cs index 0d73dc94..38e366e4 100644 --- a/PROMS/Volian.Print.Library/vlnBox.cs +++ b/PROMS/Volian.Print.Library/vlnBox.cs @@ -33,7 +33,7 @@ namespace Volian.Print.Library get { if (_Height == 0) - _Height = GetParagraphHeight(MyContentByte, IParagraph, Width); + _Height = GetParagraphHeight(MyContentByte, IParagraph,string.Empty, Width); return _Height; } set { _Height = value; } diff --git a/PROMS/Volian.Print.Library/vlnChangeBar.cs b/PROMS/Volian.Print.Library/vlnChangeBar.cs index dac8e7ef..215f6b8f 100644 --- a/PROMS/Volian.Print.Library/vlnChangeBar.cs +++ b/PROMS/Volian.Print.Library/vlnChangeBar.cs @@ -207,7 +207,7 @@ namespace Volian.Print.Library myparagraph.Alignment = MessageAlignment; myparagraph.Leading = iFont.Size; float w = GetTableWidth(cb, myparagraph, MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth); - float h = GetParagraphHeight(cb, myparagraph, w); + float h = GetParagraphHeight(cb, myparagraph, string.Empty, w); cb.SetColorFill(changeBarColor); float yloc = yBottom + h - Rtf2Pdf.Offset.Y + 2.7F; if (_MsgAtTop) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 670727ba..18e8fc39 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1097,6 +1097,24 @@ namespace Volian.Print.Library return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray()); } private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header) + protected float _ContinueHeight=0; + public virtual float ContinueHeight + { + get + { + int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.ContinueHeight"); + if (_ContinueHeight == 0 + && MyItemInfo.MyDocStyle.Continue.Top.Message.Contains("%s") + && MyItemInfo.MyDocStyle.Continue.Top.Message.ToUpper().EndsWith(" (Continued)".ToUpper())) + { + string suffix = MyItemInfo.MyDocStyle.Continue.Top.Message.Replace("%sR","").Replace("%s",""); + _ContinueHeight = GetParagraphHeight(MyContentByte, IParagraph, suffix, Width); + } + ProfileTimer.Pop(profileDepth); + return _ContinueHeight; + } + set { _Height = value; } + } public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) { int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.ToPdf"); diff --git a/PROMS/Volian.Print.Library/vlnPrintObject.cs b/PROMS/Volian.Print.Library/vlnPrintObject.cs index 5d675142..ae4a2a42 100644 --- a/PROMS/Volian.Print.Library/vlnPrintObject.cs +++ b/PROMS/Volian.Print.Library/vlnPrintObject.cs @@ -125,21 +125,21 @@ namespace Volian.Print.Library { int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.Height"); if (_Height == 0) - _Height = GetParagraphHeight(MyContentByte, IParagraph, Width); + _Height = GetParagraphHeight(MyContentByte, IParagraph, string.Empty, Width); ProfileTimer.Pop(profileDepth); return _Height; } set { _Height = value; } } - public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width) + public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width) { - return GetParagraphHeight(cb, iParagraph, width, true); + return GetParagraphHeight(cb, iParagraph, suffix, width, true); } - public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException) + public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException) { VlnSvgPageHelper ph = null; if(cb != null) ph = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - float heightAll = GetHeight(cb, iParagraph, width, throwException); + float heightAll = GetHeight(cb, iParagraph, suffix, width, throwException); if (ph != null && ph.MyPromsPrinter.DebugOutput && !MyPageHelper.Back32BitPROMS) { vlnParagraph myParagraph = this as vlnParagraph; @@ -192,11 +192,20 @@ namespace Volian.Print.Library } return chk; } - public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException) + public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException) { ColumnText myColumnText = new ColumnText(cb); myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin - myColumnText.AddElement(iParagraph); + if (suffix != string.Empty) + { + Chunk chk = iParagraph.Chunks[0] as Chunk; + iParagraph.Add(new Chunk(suffix, chk.Font)); + myColumnText.AddText(iParagraph); + } + else + { + myColumnText.AddElement(iParagraph); + } //myColumnText.UseAscender = true;// Adjusts to the top of the text box. int status = myColumnText.Go(true); // Check to see if it will fit on the page. if (ColumnText.HasMoreText(status) && throwException) @@ -207,13 +216,13 @@ namespace Volian.Print.Library public float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth) { int iWidth = (int)(maxWidth ?? 72 * 8.5F); - float h = GetParagraphHeight(cb, iParagraph, iWidth); + float h = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth); int iWidthMax = iWidth; // maximum width in Characters int iDelta = iWidth / 2; iWidth = iWidth / 2; while (iDelta > 0) { - float h2 = GetParagraphHeight(cb, iParagraph, iWidth,false); + float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false); iDelta = iDelta / 2; if (h2 == h) iWidthMax = iWidth; iWidth += (h2>h ? 1: -1) * iDelta;