Table shrinking support
This commit is contained in:
parent
cf79062b90
commit
37e2227919
@ -11,13 +11,87 @@ using Volian.Print.Library;
|
|||||||
using Volian.Controls.Library;
|
using Volian.Controls.Library;
|
||||||
using iTextSharp.text;
|
using iTextSharp.text;
|
||||||
using iTextSharp.text.pdf;
|
using iTextSharp.text.pdf;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
|
||||||
|
|
||||||
namespace Volian.Print.Library
|
namespace Volian.Print.Library
|
||||||
{
|
{
|
||||||
public class vlnTable
|
#region Settings // RHM20150429 - Table Scrunch
|
||||||
|
public partial class vlnTable
|
||||||
|
{
|
||||||
|
private string _DebugInfo = null; // RHM20150429 - Table Scrunch
|
||||||
|
public string DebugInfo
|
||||||
|
{
|
||||||
|
get { return _DebugInfo; }
|
||||||
|
set { _DebugInfo = value; }
|
||||||
|
}
|
||||||
|
private int _ItemID = 0;
|
||||||
|
public int ItemID
|
||||||
|
{
|
||||||
|
get { return _ItemID; }
|
||||||
|
set { _ItemID = value; }
|
||||||
|
}
|
||||||
|
private bool _ShowDetails = false;
|
||||||
|
public bool ShowDetails
|
||||||
|
{
|
||||||
|
get { return _ShowDetails; }
|
||||||
|
set { _ShowDetails = value; }
|
||||||
|
}
|
||||||
|
private bool _IsTooBig = false;
|
||||||
|
public bool IsTooBig
|
||||||
|
{
|
||||||
|
get { return _IsTooBig; }
|
||||||
|
set { _IsTooBig = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public partial class vlnCells
|
||||||
|
{
|
||||||
|
private static float YAdjust_HContent = 4; // 4
|
||||||
|
private float YAdjust_SpacingAfter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return 8-8*MyTable.Adjustment;//0; // 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public partial class vlnCell
|
||||||
|
{
|
||||||
|
public bool ShowDetails
|
||||||
|
{ get { return MyTable.ShowDetails; } }
|
||||||
|
private static float YAdjust_h = 0; // 0
|
||||||
|
private float YAdjust_TextLocation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return 4 - 4 * MyTable.Adjustment; ;//0; // 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//public partial class vlnTable
|
||||||
|
//{
|
||||||
|
// private static float YAdjust_RowTop = 0;//8; // 0
|
||||||
|
//}
|
||||||
|
//public partial class vlnCells
|
||||||
|
//{
|
||||||
|
// private static float YAdjust_HContent = 4; // 4
|
||||||
|
// private static float YAdjust_SpacingAfter = 8;//0; // 8
|
||||||
|
//}
|
||||||
|
//public partial class vlnCell
|
||||||
|
//{
|
||||||
|
// private static float YAdjust_h = 0; // 0
|
||||||
|
// private static float YAdjust_TextLocation = 4;//0; // 4
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
public partial class vlnTable
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
private float[] _HContents;// RHM20150525 - Table Scrunch
|
||||||
|
public float[] HContents
|
||||||
|
{
|
||||||
|
get { return _HContents; }
|
||||||
|
set { _HContents = value; }
|
||||||
|
}
|
||||||
private float[] _RowTop;
|
private float[] _RowTop;
|
||||||
public float[] RowTop
|
public float[] RowTop
|
||||||
{
|
{
|
||||||
@ -99,6 +173,106 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; }
|
get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; }
|
||||||
}
|
}
|
||||||
|
private float _TotalContentHeight = 0;// RHM20150525 - Table Scrunc
|
||||||
|
public float TotalContentHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_TotalContentHeight == 0)
|
||||||
|
{
|
||||||
|
foreach (float h in HContents)
|
||||||
|
_TotalContentHeight += h;
|
||||||
|
}
|
||||||
|
return _TotalContentHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public float SpaceAvailable// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
get { return TotalContentHeight ==0 ? 0 : RowTop[RowTop.Length - 1] - TotalContentHeight; }
|
||||||
|
}
|
||||||
|
private float _TooBig;// RHM20150525 - Table Scrunc
|
||||||
|
public float TooBig
|
||||||
|
{
|
||||||
|
get { return _TooBig; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_TooBig = value;
|
||||||
|
//_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12);
|
||||||
|
//if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment);
|
||||||
|
//if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] );
|
||||||
|
float extra=(TooBig < SpaceAvailable)?(SpaceAvailable - TooBig) / HContents.Length:0;
|
||||||
|
for (int r = 0; r < RowTop.Length - 1; r++)
|
||||||
|
RowTop[r + 1] = RowTop[r] + HContents[r] + extra;
|
||||||
|
//if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private float _Adjustment = 0;// RHM20150525 - Table Scrunc
|
||||||
|
public float Adjustment
|
||||||
|
{
|
||||||
|
get { return _Adjustment; }
|
||||||
|
set { _Adjustment = value; }
|
||||||
|
}
|
||||||
|
//private float _YAdjust_RowTop = 0;//8; // 0
|
||||||
|
public float YAdjust_RowTop
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Adjustment * 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DrawRuler(PdfContentByte cb, float x, float yTop, float height)// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
|
if (myPageHelper.DebugLayer != null)
|
||||||
|
{
|
||||||
|
cb.BeginLayer(myPageHelper.DebugLayer);
|
||||||
|
cb.SaveState();
|
||||||
|
cb.SetLineWidth(.1F);
|
||||||
|
cb.SetColorStroke(new Color(System.Drawing.Color.Orange));
|
||||||
|
float yBottom = yTop - height;
|
||||||
|
cb.MoveTo(x, yTop);
|
||||||
|
cb.LineTo(x, yBottom);
|
||||||
|
int i = 0;
|
||||||
|
for (float y = yTop; y >= yBottom; y -= 10)
|
||||||
|
{
|
||||||
|
float w = 10;
|
||||||
|
if (i % 10 == 0) w = 30;
|
||||||
|
else if (i % 5 == 0) w = 20;
|
||||||
|
cb.SetLineWidth(w / 30);
|
||||||
|
i++;
|
||||||
|
cb.MoveTo(x + w, y);
|
||||||
|
cb.LineTo(x, y);
|
||||||
|
cb.Stroke();
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
cb.Stroke();
|
||||||
|
cb.RestoreState();
|
||||||
|
cb.EndLayer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ShowRowTops(string location)// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
if (!ShowDetails) return;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < RowTop.Length; i++)
|
||||||
|
sb.Append("\t" + RowTop[i].ToString());
|
||||||
|
Console.WriteLine(location + "\t" + sb.ToString());
|
||||||
|
}
|
||||||
|
private void EndSetup()// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
if (ShowDetails) ShowRowTops("vlnTable.ctor.2");
|
||||||
|
if (ShowDetails) Console.WriteLine("^^^^^^vlnTable============{0}===============", ItemID);
|
||||||
|
}
|
||||||
|
private void SetupDebug(VlnFlexGrid myFlexGrid)// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
//ShowDetails = myFlexGrid.GetMyItemInfo().InList(38329);
|
||||||
|
//if(ShowDetails) Console.WriteLine("vvvvvvlnTable============{0}===============", ItemID);
|
||||||
|
ItemInfo myItemInfo = myFlexGrid.GetMyItemInfo();
|
||||||
|
ItemID = myItemInfo.ItemID;
|
||||||
|
DebugInfo = string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} ShortPath={5} Width={6} Left={7} YOffset={8}",
|
||||||
|
0, myItemInfo.ItemID, myItemInfo.FormatStepType, myItemInfo.FormatStepData == null ? "NoStepData" : myItemInfo.FormatStepData.Type,
|
||||||
|
myItemInfo.StepLevel, myItemInfo.ShortPath, Width, XOffset, YOffset);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
|
public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
|
||||||
@ -106,13 +280,16 @@ namespace Volian.Print.Library
|
|||||||
MyFlexGrid = myFlexGrid;
|
MyFlexGrid = myFlexGrid;
|
||||||
MyContentByte = myContentByte;
|
MyContentByte = myContentByte;
|
||||||
InitializeSizes();
|
InitializeSizes();
|
||||||
|
SetupDebug(myFlexGrid);// RHM20150525 - Table Scrunc
|
||||||
MyCells = new vlnCells(this, MyFlexGrid, MyContentByte);
|
MyCells = new vlnCells(this, MyFlexGrid, MyContentByte);
|
||||||
|
EndSetup();// RHM20150525 - Table Scrunc
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
private void InitializeSizes()
|
private void InitializeSizes()
|
||||||
{
|
{
|
||||||
RowTop = new float[MyFlexGrid.Rows.Count + 1];
|
RowTop = new float[MyFlexGrid.Rows.Count + 1];
|
||||||
|
HContents = new float[MyFlexGrid.Rows.Count];// RHM20150525 - Table Scrunc
|
||||||
RowTop[0] = 0;
|
RowTop[0] = 0;
|
||||||
for (int r = 0; r < MyFlexGrid.Rows.Count; r++)
|
for (int r = 0; r < MyFlexGrid.Rows.Count; r++)
|
||||||
RowTop[r + 1] = RowTop[r] + 72 * (MyFlexGrid.Rows[r].Height == -1
|
RowTop[r + 1] = RowTop[r] + 72 * (MyFlexGrid.Rows[r].Height == -1
|
||||||
@ -120,7 +297,7 @@ namespace Volian.Print.Library
|
|||||||
ColLeft = new float[MyFlexGrid.Cols.Count + 1];
|
ColLeft = new float[MyFlexGrid.Cols.Count + 1];
|
||||||
ColLeft[0] = 0;
|
ColLeft[0] = 0;
|
||||||
for (int c = 0; c < MyFlexGrid.Cols.Count; c++)
|
for (int c = 0; c < MyFlexGrid.Cols.Count; c++)
|
||||||
ColLeft[c + 1] = ColLeft[c] + 72 * (MyFlexGrid.Cols[c].Width == -1
|
ColLeft[c + 1] = 2 + ColLeft[c] + 72 * (MyFlexGrid.Cols[c].Width == -1 // RHM20150429 - Table Scrunch
|
||||||
? MyFlexGrid.Cols.DefaultSize : MyFlexGrid.Cols[c].Width) / (float)MyFlexGrid.DPI;
|
? MyFlexGrid.Cols.DefaultSize : MyFlexGrid.Cols[c].Width) / (float)MyFlexGrid.DPI;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -134,9 +311,21 @@ namespace Volian.Print.Library
|
|||||||
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
||||||
{
|
{
|
||||||
//ZoomGrid(myColumnText, left, top);
|
//ZoomGrid(myColumnText, left, top);
|
||||||
VlnSvgPageHelper myPageHelper = myColumnText.Canvas.PdfWriter.PageEvent as VlnSvgPageHelper;
|
if(ShowDetails) Console.WriteLine("vvvvvvToPdf============{0}===============", ItemID);// RHM20150525 - Table Scrunc
|
||||||
|
ShowRowTops("ToPDF1");
|
||||||
|
PdfContentByte cb = myColumnText.Canvas; // RHM20150429 - Table Scrunch
|
||||||
|
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
|
string myLPI = myPageHelper.YMultiplier == 1.0F ? ",6LPI" : ",7LPI";
|
||||||
|
Rtf2Pdf.DrawPdfDebug(myColumnText.Canvas, left-2, top+1, left + Width, top-myPageHelper.YMultiplier *(Height+1),
|
||||||
|
DebugInfo+", Height= " + (myPageHelper.YMultiplier * Height).ToString() + myLPI, 0);
|
||||||
|
PdfLayer textLayer = myPageHelper == null ? null : myPageHelper.TextLayer; // RHM20150429 - Table Scrunch
|
||||||
|
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||||
myPageHelper.AddGap(top, top - Height, left, left + Width);
|
myPageHelper.AddGap(top, top - Height, left, left + Width);
|
||||||
MyCells.ToPdf(myColumnText, left, top);
|
MyCells.ToPdf(myColumnText, left, top);
|
||||||
|
DrawRuler(myColumnText.Canvas, left + Width, top, myPageHelper.YMultiplier * (Height + 1)); // RHM20150429 - Table Scrunch
|
||||||
|
if (textLayer != null) cb.EndLayer();
|
||||||
|
ShowRowTops("ToPDF2");
|
||||||
|
if (ShowDetails) Console.WriteLine("^^^^^^ToPdf============{0}===============", ItemID);
|
||||||
}
|
}
|
||||||
private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
||||||
{
|
{
|
||||||
@ -145,7 +334,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public class vlnCells : List<vlnCell>
|
public partial class vlnCells : List<vlnCell> // RHM20150429 - Table Scrunch
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
private VlnFlexGrid _MyFlexGrid;
|
private VlnFlexGrid _MyFlexGrid;
|
||||||
@ -160,6 +349,8 @@ namespace Volian.Print.Library
|
|||||||
get { return _MyTable; }
|
get { return _MyTable; }
|
||||||
set { _MyTable = value; }
|
set { _MyTable = value; }
|
||||||
}
|
}
|
||||||
|
public bool ShowDetails// RHM20150525 - Table Scrunc
|
||||||
|
{ get { return MyTable.ShowDetails; }}
|
||||||
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
|
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
|
||||||
public iTextSharp.text.pdf.PdfContentByte MyContentByte
|
public iTextSharp.text.pdf.PdfContentByte MyContentByte
|
||||||
{
|
{
|
||||||
@ -195,6 +386,7 @@ namespace Volian.Print.Library
|
|||||||
// Walk through
|
// Walk through
|
||||||
for (int r = 0; r < MyFlexGrid.Rows.Count; r++)
|
for (int r = 0; r < MyFlexGrid.Rows.Count; r++)
|
||||||
{
|
{
|
||||||
|
float hMax = 12; // RHM20150429 - Table Scrunch
|
||||||
for (int c = 0; c < MyFlexGrid.Cols.Count; c++)
|
for (int c = 0; c < MyFlexGrid.Cols.Count; c++)
|
||||||
{
|
{
|
||||||
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
|
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
|
||||||
@ -212,7 +404,7 @@ namespace Volian.Print.Library
|
|||||||
str = dt.StartText;
|
str = dt.StartText;
|
||||||
str = PreProcessRTF(w, str);
|
str = PreProcessRTF(w, str);
|
||||||
iTextSharp.text.Paragraph myPara = RtfToParagraph(str);
|
iTextSharp.text.Paragraph myPara = RtfToParagraph(str);
|
||||||
myColumnText1.SetSimpleColumn(0, 0, w - 2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4
|
myColumnText1.SetSimpleColumn(0, 0, w-2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4
|
||||||
if (str.Contains(@"\'05"))
|
if (str.Contains(@"\'05"))
|
||||||
{
|
{
|
||||||
// if there is a hanging indent, the iTextSharp paragraph properties must be set
|
// if there is a hanging indent, the iTextSharp paragraph properties must be set
|
||||||
@ -234,22 +426,78 @@ namespace Volian.Print.Library
|
|||||||
// once there is valid value for TotalLeading (from previous line), you can use it to
|
// once there is valid value for TotalLeading (from previous line), you can use it to
|
||||||
// calculate a MultipliedLeading to give 6 LPI (12 points)
|
// calculate a MultipliedLeading to give 6 LPI (12 points)
|
||||||
myPara.MultipliedLeading = 12.0f / myPara.TotalLeading;
|
myPara.MultipliedLeading = 12.0f / myPara.TotalLeading;
|
||||||
|
|
||||||
myPara.SpacingAfter = 8; // RHM 20120925 - Add a line to properly space text from lines.
|
myPara.SpacingAfter = 8; // RHM 20120925 - Add a line to properly space text from lines.
|
||||||
|
if(Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase2)) // RHM20150429 - Table Scrunch
|
||||||
|
myPara.SpacingAfter = 0;// YAdjust_SpacingAfter; // RHM 20120925 - Add a line to properly space text from lines.
|
||||||
FixHyphens(myPara, MyTable);
|
FixHyphens(myPara, MyTable);
|
||||||
|
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase3))
|
||||||
|
TrimNewlines(myPara); // RHM20150429 - Table Scrunch
|
||||||
myColumnText1.AddElement(myPara);
|
myColumnText1.AddElement(myPara);
|
||||||
//myColumnText1.Canvas.SetColorFill(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
//myColumnText1.Canvas.SetColorFill(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||||
float posBefore = myColumnText1.YLine;
|
float posBefore = myColumnText1.YLine;
|
||||||
int status = myColumnText1.Go(true);
|
int status = myColumnText1.Go(true);
|
||||||
float posAfter = myColumnText1.YLine;
|
float posAfter = myColumnText1.YLine;
|
||||||
float hContent = 4 + posBefore - posAfter;
|
float hContent = 4 + posBefore - posAfter;
|
||||||
|
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase4))// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
hContent = 0 + posBefore - posAfter;//YAdjust_HContent + posBefore - posAfter;
|
||||||
|
// if (myPara.Chunks.Count > 0 && myPara.Chunks[myPara.Chunks.Count - 1] == "\n")
|
||||||
|
// hContent -= 12;
|
||||||
|
}
|
||||||
|
//if(ShowDetails) Console.WriteLine("{0}\t{1}\t{2}",r,c, hContent/12);
|
||||||
|
if (cr.r1 == cr.r2)
|
||||||
|
hMax = Math.Max(hMax, hContent);
|
||||||
|
else
|
||||||
|
hMax = Math.Max(hMax, hContent - (cr.r2 - cr.r1) * _SixLinesPerInch);
|
||||||
if (hContent > h)
|
if (hContent > h)
|
||||||
|
{ // RHM20150429 - Table Scrunch
|
||||||
|
//if (ShowDetails) Console.WriteLine("Less {0},{1},{2},{3},{4},{5}", r, c, posBefore, posAfter, hContent, hMax);
|
||||||
MyTable.AdjustRowTop(cr.r1, cr.r2, hContent);
|
MyTable.AdjustRowTop(cr.r1, cr.r2, hContent);
|
||||||
Add(new vlnCell(cr.r1, cr.c1, cr.r2, cr.c2, MyTable, myPara, hContent));
|
} // RHM20150429 - Table Scrunch
|
||||||
|
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase5))
|
||||||
|
{
|
||||||
|
//if (ShowDetails) Console.WriteLine("Greater{0},{1},{2},{3},{4},{5}", r, c, posBefore, posAfter, hContent, hMax);
|
||||||
|
//if (c == MyFlexGrid.Cols.Count - 1)
|
||||||
|
//MyTable.AdjustRowTop(cr.r1, cr.r2, hMax + 6);
|
||||||
|
MyTable.HContents[cr.r2] = hMax+2;
|
||||||
|
}
|
||||||
|
Add(new vlnCell(cr.r1, cr.c1, cr.r2, cr.c2, MyTable, myPara,hContent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void ShowChunks(System.Collections.ArrayList chunks) // RHM20150429 - Table Scrunch
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (Chunk chk in chunks)
|
||||||
|
{
|
||||||
|
sb.Append(BuildChunks(chk.Content));
|
||||||
|
}
|
||||||
|
//if (ShowDetails) Console.WriteLine("Chunks = '{0}'", sb.ToString());
|
||||||
|
}
|
||||||
|
private string BuildChunks(string str)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach(char c in str)
|
||||||
|
{
|
||||||
|
if (((int)c) < 0x20 || ((int)c) > 0x7F)
|
||||||
|
sb.Append(string.Format("<{0:X4}>",(int)c));
|
||||||
|
else
|
||||||
|
sb.Append(c);
|
||||||
|
}
|
||||||
|
return "{" + sb.ToString() + "}";
|
||||||
|
}
|
||||||
|
private void TrimNewlines(Paragraph myPara)
|
||||||
|
{
|
||||||
|
while (myPara.Chunks.Count > 0 && ParaEndsWithNewLine(myPara))
|
||||||
|
myPara.RemoveAt(myPara.Chunks.Count - 1);
|
||||||
|
}
|
||||||
|
private bool ParaEndsWithNewLine(Paragraph myPara)
|
||||||
|
{
|
||||||
|
Chunk chk = myPara.Chunks[myPara.Chunks.Count - 1] as Chunk;
|
||||||
|
if (chk.Content == "\n") return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public class VlnSplitCharacter : ISplitCharacter
|
public class VlnSplitCharacter : ISplitCharacter
|
||||||
{
|
{
|
||||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||||
@ -418,7 +666,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public class vlnCell
|
public partial class vlnCell // RHM20150429 - Table Scrunch
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
private vlnTable _MyTable;
|
private vlnTable _MyTable;
|
||||||
@ -753,15 +1001,32 @@ namespace Volian.Print.Library
|
|||||||
float w = MyTable.ColLeft[c2 + 1] - x;
|
float w = MyTable.ColLeft[c2 + 1] - x;
|
||||||
float y = mult * MyTable.RowTop[r1];
|
float y = mult * MyTable.RowTop[r1];
|
||||||
float h = mult * MyTable.RowTop[r2 + 1] - y;
|
float h = mult * MyTable.RowTop[r2 + 1] - y;
|
||||||
|
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase6))// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
h = YAdjust_h + mult * MyTable.RowTop[r2 + 1] - y;
|
||||||
|
|
||||||
|
}
|
||||||
BordersToPdf(myColumnText, left, top, x, w, y, h );
|
BordersToPdf(myColumnText, left, top, x, w, y, h );
|
||||||
float hAdjust = VeritcalTextAlignment(h);
|
float hAdjust = VeritcalTextAlignment(h,_MyPageHelper.YMultiplier);
|
||||||
iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas);
|
iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas);
|
||||||
float adjustTextLocation = mult * 4; // RHM 20120925 Move text down about 1 half line from the border
|
float adjustTextLocation = mult * 4; // RHM 20120925 Move text down about 1 half line from the border
|
||||||
myColumnText1.SetSimpleColumn(1 + left + x, top - y - h , left + x + w, 1 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding
|
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase7))// RHM20150525 - Table Scrunc
|
||||||
|
{
|
||||||
|
adjustTextLocation = mult * 0;
|
||||||
|
if (mult != 1F) adjustTextLocation=1;
|
||||||
|
}
|
||||||
|
myColumnText1.SetSimpleColumn(1 + left + x, top - y - h , left + x + w - 2, 1 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding
|
||||||
|
if (ShowDetails) Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t\"{9}\""
|
||||||
|
, r1, c1, hAdjust, adjustTextLocation, y, h, top, 1 + top - y - hAdjust - adjustTextLocation,
|
||||||
|
_MyPageHelper.YMultiplier, MyPara.Content.Substring(0, Math.Min(20, MyPara.Content.Length)));
|
||||||
MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier;
|
MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier;
|
||||||
vlnCells.FixHyphens(MyPara, MyTable);
|
vlnCells.FixHyphens(MyPara, MyTable);
|
||||||
myColumnText1.AddElement(MyPara);
|
myColumnText1.AddElement(MyPara);
|
||||||
|
float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
||||||
myColumnText1.Go();
|
myColumnText1.Go();
|
||||||
|
float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
||||||
|
if(ShowDetails)Console.WriteLine("ToPDF posBefore,posAfter,difference={0},{1},{2},{3}",
|
||||||
|
posBefore, posAfter, posBefore - posAfter,w);
|
||||||
myColumnText.Canvas.RestoreState();
|
myColumnText.Canvas.RestoreState();
|
||||||
}
|
}
|
||||||
private static float _SixLinesPerInch = 12; // twips
|
private static float _SixLinesPerInch = 12; // twips
|
||||||
@ -790,7 +1055,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Private Text Methods
|
#region Private Text Methods
|
||||||
private float VeritcalTextAlignment(float h)
|
private float VeritcalTextAlignment(float h, float mult)
|
||||||
{
|
{
|
||||||
float hAdjust = 0;
|
float hAdjust = 0;
|
||||||
//CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
//CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
||||||
@ -802,13 +1067,15 @@ namespace Volian.Print.Library
|
|||||||
case TextAlignEnum.GeneralBottom:
|
case TextAlignEnum.GeneralBottom:
|
||||||
case TextAlignEnum.LeftBottom:
|
case TextAlignEnum.LeftBottom:
|
||||||
case TextAlignEnum.RightBottom:
|
case TextAlignEnum.RightBottom:
|
||||||
hAdjust = h - HContent;
|
hAdjust = Math.Max(0,h - (mult * HContent) )-1;
|
||||||
|
Console.WriteLine("\"Bottom\",{0},{1},{2}", h, HContent, hAdjust);
|
||||||
break;
|
break;
|
||||||
case TextAlignEnum.CenterCenter:
|
case TextAlignEnum.CenterCenter:
|
||||||
case TextAlignEnum.GeneralCenter:
|
case TextAlignEnum.GeneralCenter:
|
||||||
case TextAlignEnum.LeftCenter:
|
case TextAlignEnum.LeftCenter:
|
||||||
case TextAlignEnum.RightCenter:
|
case TextAlignEnum.RightCenter:
|
||||||
hAdjust = (h - HContent) / 2;
|
hAdjust = Math.Max(0,(h - (mult * HContent)) / 2)-1;
|
||||||
|
Console.WriteLine("\"Middle\",{0},{1},{2}", h, HContent, hAdjust);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -403,7 +403,8 @@ namespace Volian.Print.Library
|
|||||||
KeepStepsOnPage = true;
|
KeepStepsOnPage = true;
|
||||||
float mySize7LPI = mySize; // +SixLinesPerInch;
|
float mySize7LPI = mySize; // +SixLinesPerInch;
|
||||||
if (_Match16BitPagination) mySize7LPI += SixLinesPerInch;
|
if (_Match16BitPagination) mySize7LPI += SixLinesPerInch;
|
||||||
if (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break
|
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
|
||||||
|
if (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg - tableSpaceAvailable <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break
|
||||||
{
|
{
|
||||||
// Don't want extra line before step
|
// Don't want extra line before step
|
||||||
//Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
//Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||||
@ -422,7 +423,7 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
// ySize7LPI includes a blank line after the step which we don't want to include in the page break test.
|
// ySize7LPI includes a blank line after the step which we don't want to include in the page break test.
|
||||||
else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps
|
else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps
|
||||||
&& (mySize7LPI - SixLinesPerInch + yEndMsg) < (yPageSizeNextPage * SixLinesPerInch / _SevenLinesPerInch))
|
&& (mySize7LPI - SixLinesPerInch + yEndMsg - tableSpaceAvailable) < (yPageSizeNextPage * SixLinesPerInch / _SevenLinesPerInch))// RHM20150525 - Table Scrunch
|
||||||
{
|
{
|
||||||
// ooooooooo ooooo ooooooooo. ooooo
|
// ooooooooo ooooo ooooooooo. ooooo
|
||||||
// d"""""""8' `888' `888 `Y88. `888'
|
// d"""""""8' `888' `888 `Y88. `888'
|
||||||
@ -1316,6 +1317,19 @@ namespace Volian.Print.Library
|
|||||||
// DebugPagination.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", YVeryTop - yTopMost, YSize, YBottomMost - yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000,
|
// DebugPagination.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", YVeryTop - yTopMost, YSize, YBottomMost - yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000,
|
||||||
// parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1);
|
// parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1);
|
||||||
//}
|
//}
|
||||||
|
public float TableSpaceAvailable// RHM20150525 - Table Scrunch
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float retval = 0;
|
||||||
|
if(_ChildrenBelow!= null)
|
||||||
|
foreach (vlnParagraph pgh in _ChildrenBelow)
|
||||||
|
retval += pgh.TableSpaceAvailable;
|
||||||
|
if (MyGrid != null)
|
||||||
|
retval += MyGrid.SpaceAvailable;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public partial class VlnSvgPageHelper : SvgPageHelper
|
public partial class VlnSvgPageHelper : SvgPageHelper
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,21 @@ using System.IO;
|
|||||||
|
|
||||||
namespace Volian.Print.Library
|
namespace Volian.Print.Library
|
||||||
{
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum TableScrunching:short // RHM20150507 Table Scrunch
|
||||||
|
{
|
||||||
|
None=0,
|
||||||
|
Phase1=1,
|
||||||
|
Phase2=2,
|
||||||
|
Phase3=4,
|
||||||
|
Phase4=8,
|
||||||
|
Phase5=16,
|
||||||
|
Phase6=32,
|
||||||
|
Phase7=64,
|
||||||
|
Phase8=128,
|
||||||
|
Phase9=256,
|
||||||
|
Phase10=512
|
||||||
|
}
|
||||||
public class Rtf2Pdf
|
public class Rtf2Pdf
|
||||||
{
|
{
|
||||||
private string _Rtf;
|
private string _Rtf;
|
||||||
@ -99,6 +114,16 @@ namespace Volian.Print.Library
|
|||||||
return (c == ' ');
|
return (c == ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static TableScrunching _AllowTableScrunching = TableScrunching.None; // RHM20150507 Table Scrunch
|
||||||
|
public static TableScrunching AllowTableScrunching
|
||||||
|
{
|
||||||
|
get { return Rtf2Pdf._AllowTableScrunching; }
|
||||||
|
set { Rtf2Pdf._AllowTableScrunching = value; }
|
||||||
|
}
|
||||||
|
public static bool GetTableScrunchingStatus(TableScrunching val)
|
||||||
|
{
|
||||||
|
return (val & _AllowTableScrunching) == val;
|
||||||
|
}
|
||||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||||
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin)
|
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin)
|
||||||
{
|
{
|
||||||
@ -115,7 +140,7 @@ namespace Volian.Print.Library
|
|||||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||||
float left = x + Offset.X;
|
float left = x + Offset.X;
|
||||||
float top = y + Offset.Y;
|
float top = y + Offset.Y + _MyPageHelper.TableAdjustment;// RHM20150525 - Table Scrunch
|
||||||
float right = left + width;
|
float right = left + width;
|
||||||
float bottom = top - height;
|
float bottom = top - height;
|
||||||
ColumnText myColumnText = new ColumnText(cb);
|
ColumnText myColumnText = new ColumnText(cb);
|
||||||
@ -188,20 +213,20 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
public static float GridAt(PdfContentByte cb, vlnTable myGrid, float x, float y, float width, float height, string debugText, float yBottomMargin, bool hasBorder)
|
public static float GridAt(PdfContentByte cb, vlnTable myGrid, float x, float y, float width, float height, string debugText, float yBottomMargin, bool hasBorder)
|
||||||
{
|
{
|
||||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
//VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; // RHM20150507 Table Scrunch
|
||||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
//PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; // RHM20150507 Table Scrunch
|
||||||
float left = x + Offset.X;
|
float left = x + Offset.X;
|
||||||
float top = y + Offset.Y;
|
float top = y + Offset.Y;
|
||||||
float right = left + width;
|
float right = left + width;
|
||||||
float bottom = top - height;
|
float bottom = top - height;
|
||||||
ColumnText myColumnText = new ColumnText(cb);
|
ColumnText myColumnText = new ColumnText(cb);
|
||||||
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
|
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
|
||||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
//if (textLayer != null) cb.BeginLayer(textLayer); // RHM20150507 Table Scrunch
|
||||||
myGrid.ToPdf(myColumnText, left, top + GridTopAdjust);
|
myGrid.ToPdf(myColumnText, left, top + GridTopAdjust);
|
||||||
if (textLayer != null) cb.EndLayer();
|
//if (textLayer != null) cb.EndLayer(); // RHM20150507 Table Scrunch
|
||||||
return bottom;
|
return bottom;
|
||||||
}
|
}
|
||||||
private static void DrawPdfDebug(PdfContentByte cb, float left, float top, float right, float bottom, string debugText, float yDescent)
|
internal static void DrawPdfDebug(PdfContentByte cb, float left, float top, float right, float bottom, string debugText, float yDescent)
|
||||||
{
|
{
|
||||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
||||||
|
@ -14,12 +14,31 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
public partial class VlnSvgPageHelper:SvgPageHelper
|
public partial class VlnSvgPageHelper:SvgPageHelper
|
||||||
{
|
{
|
||||||
|
private float _TableAdjustment = 0;// RHM20150525 - Table Scrunch
|
||||||
|
public float TableAdjustment
|
||||||
|
{
|
||||||
|
get { return _TableAdjustment; }
|
||||||
|
set { _TableAdjustment = value; }
|
||||||
|
}
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private pkParagraphs _MyPlacekeepers = new pkParagraphs();
|
private pkParagraphs _MyPlacekeepers = new pkParagraphs();
|
||||||
public pkParagraphs MyPlacekeepers
|
public pkParagraphs MyPlacekeepers
|
||||||
{
|
{
|
||||||
get { return _MyPlacekeepers; }
|
get { return _MyPlacekeepers; }
|
||||||
}
|
}
|
||||||
|
private float? _BottomContent = null;// RHM20150525 - Table Scrunch
|
||||||
|
public float? BottomContent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _BottomContent;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null || _BottomContent == null || _BottomContent > value)
|
||||||
|
_BottomContent = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
private PageBookmarks _PageBookmarks = new PageBookmarks();
|
private PageBookmarks _PageBookmarks = new PageBookmarks();
|
||||||
public PageBookmarks PageBookmarks
|
public PageBookmarks PageBookmarks
|
||||||
{
|
{
|
||||||
@ -201,6 +220,7 @@ namespace Volian.Print.Library
|
|||||||
//}
|
//}
|
||||||
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
||||||
{
|
{
|
||||||
|
TableAdjustment = 0;// RHM20150525 - Table Scrunch
|
||||||
//string path = Volian.Base.Library.vlnStackTrace.StackToStringLocal(3, 1);
|
//string path = Volian.Base.Library.vlnStackTrace.StackToStringLocal(3, 1);
|
||||||
//Console.WriteLine("End {0}",path);
|
//Console.WriteLine("End {0}",path);
|
||||||
int profileDepth = ProfileTimer.Push(">>>> OnEndPage");
|
int profileDepth = ProfileTimer.Push(">>>> OnEndPage");
|
||||||
|
@ -301,7 +301,7 @@ namespace Volian.Print.Library
|
|||||||
box = null;
|
box = null;
|
||||||
yoff += 1 * vlnPrintObject.SixLinesPerInch;
|
yoff += 1 * vlnPrintObject.SixLinesPerInch;
|
||||||
}
|
}
|
||||||
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, pp);
|
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true, pp);
|
||||||
|
|
||||||
// if doing the component list (FNP), keep track of the bottom most columns' data
|
// if doing the component list (FNP), keep track of the bottom most columns' data
|
||||||
// so this can be returned after the row is done.
|
// so this can be returned after the row is done.
|
||||||
@ -551,7 +551,8 @@ namespace Volian.Print.Library
|
|||||||
if (MyItemInfo.MyContent.MyGrid != null)
|
if (MyItemInfo.MyContent.MyGrid != null)
|
||||||
{
|
{
|
||||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid");
|
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid");
|
||||||
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
|
// RHM20150507 Include Footer
|
||||||
|
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float) MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch
|
||||||
ProfileTimer.Pop(profileDepth);
|
ProfileTimer.Pop(profileDepth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -828,11 +829,29 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
|
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
|
||||||
if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset);
|
if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset);
|
||||||
|
//if (MyItemInfo.InList(11019,11024,111026)) // RHM20150507 Table Scrunch
|
||||||
|
// Console.WriteLine("here");
|
||||||
|
float heightBefore = MyGrid.Height+4 * MyPageHelper.YMultiplier;
|
||||||
|
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase1) && heightBefore > (yLocation - yBottomMargin))
|
||||||
|
{
|
||||||
|
//MyGrid.TooBig = (MyItemInfo.MyDocStyle.Layout.FooterLength ?? 0) + SixLinesPerInch + MyGrid.Height - (yLocation - yBottomMargin);
|
||||||
|
MyGrid.TooBig = SixLinesPerInch + MyGrid.Height * MyPageHelper.YMultiplier - (yLocation - yBottomMargin);
|
||||||
|
float heightAfter = MyGrid.Height + 4 * MyPageHelper.YMultiplier;
|
||||||
|
MyPageHelper.TableAdjustment += (heightBefore - heightAfter);
|
||||||
|
if (heightAfter < (yLocation - yBottomMargin))
|
||||||
|
{
|
||||||
|
_MyLog.ErrorFormat("<<< WARNING >>> Table is too big to fit on page, Vertical Padding adjusted to fit\r\n==>'Table Adjusted',{0},'{1}','{2}',{3},{4},{5}"
|
||||||
|
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MyGrid.IsTooBig = true;
|
||||||
|
}
|
||||||
|
MyPageHelper.BottomContent=yLocation-(MyGrid.Height + 4 * MyPageHelper.YMultiplier);
|
||||||
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
||||||
if (MyGrid.Height > (yTopMargin - yBottomMargin))
|
if (MyGrid.Height > (yTopMargin - yBottomMargin))
|
||||||
{
|
{
|
||||||
_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4}"
|
_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4},{5}" // RHM20150429 - Table Scrunch
|
||||||
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, MyGrid.Height, (yTopMargin - yBottomMargin));
|
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin));
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -883,8 +902,42 @@ namespace Volian.Print.Library
|
|||||||
DebugPagination.WriteLine("Very Low {0},{1},{2},{3},{4},{5}", MyItemInfo.ShortPath, MyItemInfo.ItemID, yLocation, Height, yLocation - Height, yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
|
DebugPagination.WriteLine("Very Low {0},{1},{2},{3},{4},{5}", MyItemInfo.ShortPath, MyItemInfo.ItemID, yLocation, Height, yLocation - Height, yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
|
||||||
}
|
}
|
||||||
int profileDepth = ProfileTimer.Push(">>>> Rtf2Pdf.TextAt");
|
int profileDepth = ProfileTimer.Push(">>>> Rtf2Pdf.TextAt");
|
||||||
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin);
|
// ooooooooo. oooooooooo. oooooooooooo ooooooooooooo o8o . o8o
|
||||||
ProfileTimer.Pop(profileDepth);
|
// `888 `Y88. `888' `Y8b `888' `8 8' 888 `8 `"' .o8 `"'
|
||||||
|
// 888 .d88' 888 888 888 888 oooo d8b .oooo. ooo. .oo. .oooo.o oooo .o888oo oooo .ooooo. ooo. .oo. .oooo.o
|
||||||
|
// 888ooo88P' 888 888 888oooo8 888 `888""8P `P )88b `888P"Y88b d88( "8 `888 888 `888 d88' `88b `888P"Y88b d88( "8
|
||||||
|
// 888 888 888 888 " 888 888 .oP"888 888 888 `"Y88b. 888 888 888 888 888 888 888 `"Y88b.
|
||||||
|
// 888 888 d88' 888 888 888 d8( 888 888 888 o. )88b 888 888 . 888 888 888 888 888 o. )88b
|
||||||
|
// o888o o888bood8P' o888o o888o d888b `Y888""8o o888o o888o 8""888P' o888o "888" o888o `Y8bod8P' o888o o888o 8""888P'
|
||||||
|
//
|
||||||
|
// Design Suggestion:
|
||||||
|
// During vlnParagraaph Constuctor Build an end point dictionary
|
||||||
|
// During toPdf check for end points before adding GoTos for Local
|
||||||
|
// Need to have a way to get to sections which do not have any output (header only)
|
||||||
|
// Need to have a way to identify procedures
|
||||||
|
//
|
||||||
|
//if (IParagraph.Chunks.Count > 0)
|
||||||
|
//{
|
||||||
|
// Chunk chk1 = IParagraph.Chunks[0] as Chunk;
|
||||||
|
// chk1.SetLocalDestination(string.Format("ItemID={0}", MyItemInfo.ItemID)); // Destination
|
||||||
|
// if (MyItemInfo.MyContent.ContentTransitionCount > 0)
|
||||||
|
// {
|
||||||
|
// TransitionInfo ti = MyItemInfo.MyContent.ContentTransitions[0];
|
||||||
|
// if (ti.MyItemToID.MyProcedure.ItemID == MyItemInfo.MyProcedure.ItemID)
|
||||||
|
// { // Local Go To
|
||||||
|
// if (ti.MyItemToID.MyContent.Type > 19999)
|
||||||
|
// foreach (Chunk chk in IParagraph.Chunks)
|
||||||
|
// chk.SetLocalGoto(string.Format("ItemID={0}", ti.ToID));
|
||||||
|
// }
|
||||||
|
// else // Remote Go To
|
||||||
|
// foreach (Chunk chk in IParagraph.Chunks)
|
||||||
|
// chk.SetRemoteGoto(ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}", ti.ToID));
|
||||||
|
// }
|
||||||
|
// MyPageHelper.BottomContent = yLocation - Height;
|
||||||
|
// if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
|
||||||
|
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
|
||||||
|
ProfileTimer.Pop(profileDepth);
|
||||||
|
//}
|
||||||
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
|
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
|
||||||
{ // pagination logic needs to be fixed.
|
{ // pagination logic needs to be fixed.
|
||||||
// oooooooooooo ooooooooo. o8o . o8o
|
// oooooooooooo ooooooooo. o8o . o8o
|
||||||
@ -2076,10 +2129,15 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
case E_ContBottomLoc.EndOfText: // place continue string at end of text
|
case E_ContBottomLoc.EndOfText: // place continue string at end of text
|
||||||
msg_yLocation = msg_yLocation + yLocation - SixLinesPerInch;
|
msg_yLocation = msg_yLocation + yLocation - SixLinesPerInch;
|
||||||
|
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
|
||||||
if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation)
|
if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation)
|
||||||
{ // Adjusted Continue Message Y Offset
|
{ // Adjusted Continue Message Y Offset
|
||||||
//DebugPagination.WriteLine("====>> {0},'{1}'", msg_yLocation, MyItemInfo.ShortPath);
|
//DebugPagination.WriteLine("====>> {0},'{1}'", msg_yLocation, MyItemInfo.ShortPath);
|
||||||
msg_yLocation = yBottomMargin + (docstyle.Layout.FooterLength ?? 0);
|
//msg_yLocation = (float) MyPageHelper.BottomContent - SixLinesPerInch; // Account for how low the lowest Item is on the page
|
||||||
|
msg_yLocation = Math.Min(yBottomMargin +(docstyle.Layout.FooterLength ?? 0),(float) MyPageHelper.BottomContent - SixLinesPerInch);// RHM20150525 - Table Scrunch
|
||||||
|
float msg_yLocationOld = yBottomMargin + (docstyle.Layout.FooterLength ?? 0);
|
||||||
|
if (msg_yLocationOld != msg_yLocation)
|
||||||
|
_MyLog.WarnFormat("Continue Message Moved from {0} to {1} for {2}", msg_yLocationOld, msg_yLocation, this);// RHM20150525 - Table Scrunch
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_ContBottomLoc.BtwnTextAndBottom: // place continue string between end of text & bottom of page
|
case E_ContBottomLoc.BtwnTextAndBottom: // place continue string between end of text & bottom of page
|
||||||
@ -2109,6 +2167,7 @@ namespace Volian.Print.Library
|
|||||||
_MyLog.WarnFormat("**** BOTTOM CONTINUE MESSAGE NOT CODED FOR LOCATION {0}*****", docstyle.Continue.Bottom.Location);
|
_MyLog.WarnFormat("**** BOTTOM CONTINUE MESSAGE NOT CODED FOR LOCATION {0}*****", docstyle.Continue.Bottom.Location);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
MyPageHelper.BottomContent = null;// RHM20150525 - Table Scrunch
|
||||||
if (!PageBreakOnStep)
|
if (!PageBreakOnStep)
|
||||||
{
|
{
|
||||||
float xoffB = 0;
|
float xoffB = 0;
|
||||||
@ -2219,8 +2278,10 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
//if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
|
//if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
|
||||||
if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
|
if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
|
||||||
if (MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)
|
if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // RHM20150507 Table Scrunch
|
||||||
process.Add(vPara);
|
process.Add(vPara);
|
||||||
|
else // RHM20150507 Table Scrunch
|
||||||
|
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}",MyItemInfo.ItemID,MyItemInfo.ShortPath);
|
||||||
}
|
}
|
||||||
foreach (vlnParagraph vPara in process)
|
foreach (vlnParagraph vPara in process)
|
||||||
{
|
{
|
||||||
@ -3788,14 +3849,14 @@ namespace Volian.Print.Library
|
|||||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm ||
|
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm ||
|
||||||
(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && MyItemInfo.IsStep && MyItemInfo.FormatStepData.StepLayoutData.STBoxindex != null))
|
(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && MyItemInfo.IsStep && MyItemInfo.FormatStepData.StepLayoutData.STBoxindex != null))
|
||||||
{
|
{
|
||||||
if ((MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.MyParent.IsCaution || MyItemInfo.MyParent.IsNote) && !MyItemInfo.FormatStepData.SpaceIn
|
if ((MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.MyParent.IsCaution || MyItemInfo.MyParent.IsNote) && !MyItemInfo.FormatStepData.SpaceIn
|
||||||
&& (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)
|
&& (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)
|
||||||
&& (MyItemInfo.NextItem == null || MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type)) return 0;
|
&& (MyItemInfo.NextItem == null || MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type)) return 0;
|
||||||
if (everyNLines == 99 && MyItemInfo.NextItem == null)
|
if (everyNLines == 99 && MyItemInfo.NextItem == null)
|
||||||
{
|
{
|
||||||
if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0;
|
if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0;
|
||||||
if (MyItemInfo.MyParent.NextItem != null && MyItemInfo.MyParent.NextItem.MyContent.Type == MyItemInfo.MyContent.Type) return 0;
|
if (MyItemInfo.MyParent.NextItem != null && MyItemInfo.MyParent.NextItem.MyContent.Type == MyItemInfo.MyContent.Type) return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
|
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
|
||||||
// Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.
|
// Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.
|
||||||
@ -4844,11 +4905,11 @@ namespace Volian.Print.Library
|
|||||||
XOffset += mycolT; // adjust caution/note text position
|
XOffset += mycolT; // adjust caution/note text position
|
||||||
if (PartsLeft != null && PartsLeft.Count > 0)// adjust tab position
|
if (PartsLeft != null && PartsLeft.Count > 0)// adjust tab position
|
||||||
{
|
{
|
||||||
if (myTab != null && (itemInfo.IsNote || itemInfo.IsCaution))
|
if(myTab!=null && (itemInfo.IsNote || itemInfo.IsCaution))
|
||||||
Width -= myTab.Width;
|
Width -= myTab.Width;
|
||||||
foreach (vlnPrintObject vpo in PartsLeft)
|
foreach (vlnPrintObject vpo in PartsLeft)
|
||||||
vpo.XOffset += mycolT;
|
vpo.XOffset += mycolT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itemInfo.IsSection)
|
else if (itemInfo.IsSection)
|
||||||
{
|
{
|
||||||
@ -4885,10 +4946,10 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
else if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
|
else if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
|
||||||
{
|
{
|
||||||
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null)
|
if(itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null)
|
||||||
Width = MyParent.MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
Width = MyParent.MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
||||||
else
|
else
|
||||||
Width = MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
Width = MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
||||||
Width -= 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
|
Width -= 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4901,7 +4962,7 @@ namespace Volian.Print.Library
|
|||||||
else if (MyParent.WidthNoLimit != 0)
|
else if (MyParent.WidthNoLimit != 0)
|
||||||
Width = adjwidth + MyParent.WidthNoLimit - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
Width = adjwidth + MyParent.WidthNoLimit - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
||||||
else if ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)
|
else if ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)
|
||||||
Width = adjwidth + MyParent.Width - (MyTab != null ? MyTab.Width : 0);
|
Width = adjwidth + MyParent.Width - (MyTab!=null?MyTab.Width:0);
|
||||||
else
|
else
|
||||||
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user