diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index 19af7b06..e96baaa6 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -52,9 +52,15 @@ namespace Volian.Print.Library set { _MyCells = value; } } public float Height - { get { return RowTop[MyFlexGrid.Rows.Count]; } } + { get + { + return RowTop[RowTop.Length - 1]; + } } public float Width - { get { return ColLeft[MyFlexGrid.Cols.Count]; } } + { get + { + return ColLeft[ColLeft.Length - 1]; + } } private static float _XOffset = -1; // This moves the borders with respect to the text public static float XOffset @@ -165,6 +171,16 @@ namespace Volian.Print.Library MyFlexGrid = myFlexGrid; MyContentByte = myContentByte; SetupCells(); + foreach(vlnCell cell in this) + { + GridLinePattern glp = cell.AboveLeftSide; + glp = cell.AboveRightSide; + glp = cell.BelowLeftSide; + glp = cell.BelowRightSide; + glp = cell.RightOfBottomSide; + glp = cell.RightOfTopSide; + object ta = cell.TextAlign; + } } #endregion #region Private Methods @@ -190,18 +206,7 @@ namespace Volian.Print.Library } DisplayText dt = new DisplayText(MyFlexGrid.GetMyItemInfo(), str, false); str = dt.StartText; - using (StepRTB myRTB = new StepRTB()) - { - myRTB.Width = (int)w; - myRTB.Font = MyFlexGrid.Font; - if (str.StartsWith(@"{\rtf")) - myRTB.Rtf = str.Replace(@"\~", @"\u160?"); - else - myRTB.Text = str; - myRTB.SelectAll(); - myRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black); - str = myRTB.Rtf; - } + str = PreProcessRTF(w, str); iTextSharp.text.Paragraph myPara = RtfToParagraph(str); myColumnText1.SetSimpleColumn(0, 0, w - 2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4 @@ -226,6 +231,21 @@ namespace Volian.Print.Library } } } + private static StepRTB _StatRTB = new StepRTB(); + private string PreProcessRTF(float w, string str) + { + _StatRTB.Text = string.Empty; + _StatRTB.Width = (int)w; + _StatRTB.Font = MyFlexGrid.Font; + if (str.StartsWith(@"{\rtf")) + _StatRTB.Rtf = str.Replace(@"\~", @"\u160?"); + else + _StatRTB.Text = str; + _StatRTB.SelectAll(); + _StatRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black); + str = _StatRTB.Rtf; + return str; + } public static iTextSharp.text.Paragraph RtfToParagraph(string rtf) { IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf); @@ -590,15 +610,38 @@ namespace Volian.Print.Library myColumnText.Canvas.RestoreState(); } private static float _SixLinesPerInch = 12; // twips + public bool IsRangeStyleNull = false; + private TextAlignEnum? _TextAlign = null; + public TextAlignEnum? TextAlign + { + get + { + if (_TextAlign == null) + { + CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2); + if (cr.Style == null) + { + IsRangeStyleNull = true; + return _TextAlign; + } + else + { + IsRangeStyleNull = false; + _TextAlign = cr.Style.TextAlign; + } + } + return (TextAlignEnum)_TextAlign; + } + } #endregion #region Private Text Methods private float VeritcalTextAlignment(float h) { float hAdjust = 0; - CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2); - if (cr.Style != null) + //CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2); + if (!IsRangeStyleNull) { - switch (cr.Style.TextAlign) + switch (TextAlign) { case TextAlignEnum.CenterBottom: case TextAlignEnum.GeneralBottom: diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 658a89a1..c7dc807d 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1679,9 +1679,9 @@ namespace Volian.Print.Library bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff; if (itemInfo.MyContent.MyGrid != null) { - VlnFlexGrid myFlexGrid = new VlnFlexGrid(1, 1); - myFlexGrid.LoadGrid(itemInfo); - MyGrid = new vlnTable(myFlexGrid, cb); + //VlnFlexGrid myFlexGrid = new VlnFlexGrid(1, 1); + MyFlexGrid.LoadGrid(itemInfo); + MyGrid = new vlnTable(MyFlexGrid, cb); Height = MyGrid.Height; Width = MyGrid.Width; @@ -1700,7 +1700,7 @@ namespace Volian.Print.Library // if the table does not have a border, only move down one line: float yoffForBorder = 2 * SixLinesPerInch; - if (myFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !myFlexGrid.TopRowHasBorder()) + if (MyFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !MyFlexGrid.TopRowHasBorder()) yoffForBorder -= SixLinesPerInch; //yForCheckoff = yoff + Height - SixLinesPerInch; @@ -3034,7 +3034,7 @@ namespace Volian.Print.Library // For Robinson, tried using font's CharsToTwips but it made it too narrow, so used hardcoded 6: CheckOffAdj = -((float)9 * 6); } - float adjwidth = CheckOffAdj; + float adjwidth = CheckOffAdj; SectData sd = formatInfo.PlantFormat.FormatData.SectData; if (sd.UseMetaSections) {