diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index b2ac1615..980abd20 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Drawing; using System.Text.RegularExpressions; +using System.IO; using iTextSharp.text.pdf; using iTextSharp.text; using Itenso.Rtf; @@ -99,8 +100,15 @@ namespace Volian.Print.Library } public partial class vlnParagraph : vlnPrintObject { + private vlnTable _MyGrid; + public vlnTable MyGrid + { + get { return _MyGrid; } + set { _MyGrid = value; } + } + /// - /// This variable is used to match 16 bit pagaination + /// This variable is used to match 16 bit pagination /// private bool _Match16BitPagination = false; // the following boolean is to help testing of various formats. If the plant has an alternating foldout @@ -127,11 +135,14 @@ namespace Volian.Print.Library } else if (!MyItemInfo.IsStepSection) // Don't ouput the Step Section title { - retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); + if (MyItemInfo.MyContent.MyGrid != null) + retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); + else + retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); if (MyItemInfo.IsHigh) { - MyPageHelper.VlnDestinations.Add(MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, - new PdfDestination(PdfDestination.FITBH,yLocation+YVeryTop-YTopMost+SixLinesPerInch)); + MyPageHelper.VlnDestinations.Add(MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, + new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); } } //Height = yLocation - retval; @@ -143,6 +154,14 @@ namespace Volian.Print.Library return yPageStart; } + private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) + { + if (_TextDebug) + Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); + float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugText, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); + return retval; + } + private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) { if (_TextDebug) @@ -747,7 +766,21 @@ namespace Volian.Print.Library YOffset = yoff; AddMacros(itemInfo, mytab); if (mytab != null) mytab.YOffset = yoff; - if (itemInfo.IsFigure) // if a figure we've got to determine the size: + if (itemInfo.MyContent.MyGrid != null) + { + VlnFlexGrid myFlexGrid = new VlnFlexGrid(1,1); + using (StringReader sr = new StringReader(itemInfo.MyContent.MyGrid.Data)) + { + myFlexGrid.ReadXml(sr); + sr.Close(); + } + MyGrid = new vlnTable(myFlexGrid, cb); + Height = MyGrid.Height; + Width = MyGrid.Width; + yoff += (Height + (2 * SixLinesPerInch)); + CalculateXOffset(itemInfo, maxRNO, formatInfo); + } + else if (itemInfo.IsFigure) // if a figure we've got to determine the size: { if (itemInfo.MyContent.Text != null) { @@ -790,7 +823,7 @@ namespace Volian.Print.Library else { Rtf = GetRtf(itemInfo); - if (itemInfo.IsTablePart) + if (itemInfo.IsTablePart) // Not for grid, this is for old-style tables. { Width = GetTableWidth(cb, IParagraph); CalculateXOffset(itemInfo, maxRNO, formatInfo);