Table shrinking support

This commit is contained in:
Rich
2015-05-27 18:48:14 +00:00
parent cf79062b90
commit 37e2227919
5 changed files with 430 additions and 43 deletions

View File

@@ -13,6 +13,21 @@ using System.IO;
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
{
private string _Rtf;
@@ -99,6 +114,16 @@ namespace Volian.Print.Library
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 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;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
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 bottom = top - height;
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)
{
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
//VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; // RHM20150507 Table Scrunch
//PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; // RHM20150507 Table Scrunch
float left = x + Offset.X;
float top = y + Offset.Y;
float right = left + width;
float bottom = top - height;
ColumnText myColumnText = new ColumnText(cb);
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);
if (textLayer != null) cb.EndLayer();
//if (textLayer != null) cb.EndLayer(); // RHM20150507 Table Scrunch
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;
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;