This commit is contained in:
Kathy Ruffing 2011-03-09 12:11:23 +00:00
parent 73f50dff80
commit 579f1c9af5

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Drawing; using System.Drawing;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.IO;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text; using iTextSharp.text;
using Itenso.Rtf; using Itenso.Rtf;
@ -99,8 +100,15 @@ namespace Volian.Print.Library
} }
public partial class vlnParagraph : vlnPrintObject public partial class vlnParagraph : vlnPrintObject
{ {
private vlnTable _MyGrid;
public vlnTable MyGrid
{
get { return _MyGrid; }
set { _MyGrid = value; }
}
/// <summary> /// <summary>
/// This variable is used to match 16 bit pagaination /// This variable is used to match 16 bit pagination
/// </summary> /// </summary>
private bool _Match16BitPagination = false; private bool _Match16BitPagination = false;
// the following boolean is to help testing of various formats. If the plant has an alternating foldout // 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 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) if (MyItemInfo.IsHigh)
{ {
MyPageHelper.VlnDestinations.Add(MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, MyPageHelper.VlnDestinations.Add(MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText,
new PdfDestination(PdfDestination.FITBH,yLocation+YVeryTop-YTopMost+SixLinesPerInch)); new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch));
} }
} }
//Height = yLocation - retval; //Height = yLocation - retval;
@ -143,6 +154,14 @@ namespace Volian.Print.Library
return yPageStart; return yPageStart;
} }
private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{
if (_TextDebug)
Console.WriteLine("{0},{1},'{2}','<<END>>'", 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) private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
if (_TextDebug) if (_TextDebug)
@ -747,7 +766,21 @@ namespace Volian.Print.Library
YOffset = yoff; YOffset = yoff;
AddMacros(itemInfo, mytab); AddMacros(itemInfo, mytab);
if (mytab != null) mytab.YOffset = yoff; 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) if (itemInfo.MyContent.Text != null)
{ {
@ -790,7 +823,7 @@ namespace Volian.Print.Library
else else
{ {
Rtf = GetRtf(itemInfo); Rtf = GetRtf(itemInfo);
if (itemInfo.IsTablePart) if (itemInfo.IsTablePart) // Not for grid, this is for old-style tables.
{ {
Width = GetTableWidth(cb, IParagraph); Width = GetTableWidth(cb, IParagraph);
CalculateXOffset(itemInfo, maxRNO, formatInfo); CalculateXOffset(itemInfo, maxRNO, formatInfo);