This commit is contained in:
parent
0d79abd34d
commit
e439f31c1f
@ -1906,6 +1906,7 @@ namespace Volian.Controls.Library
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
if (!myGrid.SelectNextCell())
|
if (!myGrid.SelectNextCell())
|
||||||
{
|
{
|
||||||
|
myGrid.MyBorders.InsertRow(myGrid.Rows.Count - 1);
|
||||||
myGrid.Rows.Add(1);
|
myGrid.Rows.Add(1);
|
||||||
myGrid.SelectNextCell();
|
myGrid.SelectNextCell();
|
||||||
}
|
}
|
||||||
|
@ -779,16 +779,23 @@ namespace Volian.Controls.Library
|
|||||||
int y1 = bounds.Top;
|
int y1 = bounds.Top;
|
||||||
int x2 = bounds.Right - 1;
|
int x2 = bounds.Right - 1;
|
||||||
int y2 = bounds.Bottom - 1;
|
int y2 = bounds.Bottom - 1;
|
||||||
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}", e.Row, e.Col, (e.Style ?? Styles.Normal).Name, lineTop, lineLeft, lineBottom, lineRight);
|
// We should look at the results of the following for Focus Style
|
||||||
Color bColor = Color.Blue; // Temporary - Set the border color to blue.
|
Color bColor = Color.Blue; // Temporary - Set the border color to blue.
|
||||||
GridItem myGridItem = Parent as GridItem;
|
if ((e.Style ?? Styles.Normal).Name == "Focus")
|
||||||
if (myGridItem == null) return;
|
{
|
||||||
|
if (lineRight == GridLinePattern.Thick || lineRight == GridLinePattern.Double)
|
||||||
|
lineRight = GridLinePattern.Single;
|
||||||
|
if (lineBottom == GridLinePattern.Thick || lineBottom == GridLinePattern.Double)
|
||||||
|
lineBottom = GridLinePattern.Single;
|
||||||
|
}
|
||||||
|
GridItem myGridItem = Parent as GridItem;
|
||||||
|
if (myGridItem == null) return;
|
||||||
if (row == 0 && lineTop != GridLinePattern.None)
|
if (row == 0 && lineTop != GridLinePattern.None)
|
||||||
{
|
{
|
||||||
Pen pn = VlnBorders.LinePen(lineTop, bColor);
|
Pen pn = VlnBorders.LinePen(lineTop, bColor);
|
||||||
GridLinePattern lineTopLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c1 - 1];
|
//GridLinePattern lineTopLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c1 - 1];
|
||||||
GridLinePattern lineTopRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c2 + 1];
|
GridLinePattern lineTopRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c2 + 1];
|
||||||
int dxTop = col == 0 ? (lineLeft == GridLinePattern.Double ? -3 :-1): 0;
|
int dxTop = col == 0 ? (lineLeft == GridLinePattern.Double || lineLeft == GridLinePattern.Thick ? -3 : -1) : 0;
|
||||||
int dx = col == 0 ? -1 : 0;
|
int dx = col == 0 ? -1 : 0;
|
||||||
using (Graphics grParent = myGridItem.CreateGraphics())
|
using (Graphics grParent = myGridItem.CreateGraphics())
|
||||||
{
|
{
|
||||||
@ -810,9 +817,9 @@ namespace Volian.Controls.Library
|
|||||||
if (col == 0 && lineLeft != GridLinePattern.None)
|
if (col == 0 && lineLeft != GridLinePattern.None)
|
||||||
{
|
{
|
||||||
Pen pn = VlnBorders.LinePen(lineLeft, bColor);
|
Pen pn = VlnBorders.LinePen(lineLeft, bColor);
|
||||||
GridLinePattern lineLeftAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c1];
|
//GridLinePattern lineLeftAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c1];
|
||||||
GridLinePattern lineLeftBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c1];
|
GridLinePattern lineLeftBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c1];
|
||||||
int dyLeft = row == 0 ? (lineTop == GridLinePattern.Double ? -3:-1) : 0;
|
int dyLeft = row == 0 ? (lineLeft == GridLinePattern.Double || lineLeft == GridLinePattern.Thick ? -3 : -1) : 0;
|
||||||
int dy = row == 0 ? -1 : 0;
|
int dy = row == 0 ? -1 : 0;
|
||||||
//GridItem myGridItem = Parent as GridItem;
|
//GridItem myGridItem = Parent as GridItem;
|
||||||
using (Graphics grParent = myGridItem.CreateGraphics())
|
using (Graphics grParent = myGridItem.CreateGraphics())
|
||||||
@ -831,9 +838,9 @@ namespace Volian.Controls.Library
|
|||||||
grParent.DrawLine(pn, x1 + Left - 2, y1 + Top + dyLeft, x1 + Left - 2, y2 + Top + 1);
|
grParent.DrawLine(pn, x1 + Left - 2, y1 + Top + dyLeft, x1 + Left - 2, y2 + Top + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GridLinePattern lineBottomLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c1 - 1];
|
//GridLinePattern lineBottomLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c1 - 1];
|
||||||
GridLinePattern lineBottomRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c2 + 1];
|
GridLinePattern lineBottomRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c2 + 1];
|
||||||
GridLinePattern lineRightAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c2 + 1];
|
//GridLinePattern lineRightAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c2 + 1];
|
||||||
GridLinePattern lineRightBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c2 + 1];
|
GridLinePattern lineRightBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c2 + 1];
|
||||||
if (lineBottom != GridLinePattern.None)
|
if (lineBottom != GridLinePattern.None)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@ using Itenso.Rtf.Interpreter;
|
|||||||
using Itenso.Rtf.Support;
|
using Itenso.Rtf.Support;
|
||||||
using Volian.Print.Library;
|
using Volian.Print.Library;
|
||||||
using Volian.Controls.Library;
|
using Volian.Controls.Library;
|
||||||
|
using iTextSharp.text.pdf;
|
||||||
|
|
||||||
|
|
||||||
namespace Volian.Print.Library
|
namespace Volian.Print.Library
|
||||||
@ -34,6 +35,10 @@ namespace Volian.Print.Library
|
|||||||
get { return _MyFlexGrid; }
|
get { return _MyFlexGrid; }
|
||||||
set { _MyFlexGrid = value; }
|
set { _MyFlexGrid = value; }
|
||||||
}
|
}
|
||||||
|
public VlnBorders MyBorders
|
||||||
|
{
|
||||||
|
get { return _MyFlexGrid.MyBorders; }
|
||||||
|
}
|
||||||
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
|
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
|
||||||
public iTextSharp.text.pdf.PdfContentByte MyContentByte
|
public iTextSharp.text.pdf.PdfContentByte MyContentByte
|
||||||
{
|
{
|
||||||
@ -50,6 +55,41 @@ namespace Volian.Print.Library
|
|||||||
{ get { return RowTop[MyFlexGrid.Rows.Count]; } }
|
{ get { return RowTop[MyFlexGrid.Rows.Count]; } }
|
||||||
public float Width
|
public float Width
|
||||||
{ get { return ColLeft[MyFlexGrid.Cols.Count]; } }
|
{ get { return ColLeft[MyFlexGrid.Cols.Count]; } }
|
||||||
|
|
||||||
|
private static float _XOffset = -1; // This moves the borders with respect to the text
|
||||||
|
public static float XOffset
|
||||||
|
{
|
||||||
|
get { return vlnTable._XOffset; }
|
||||||
|
set { vlnTable._XOffset = value; }
|
||||||
|
}
|
||||||
|
private static float _YOffset = 0; // This moves the borders with respect to the text
|
||||||
|
public static float YOffset
|
||||||
|
{
|
||||||
|
get { return vlnTable._YOffset; }
|
||||||
|
set { vlnTable._YOffset = value; }
|
||||||
|
}
|
||||||
|
private static float _LineThicknessForThin = .9F;
|
||||||
|
public static float LineThicknessForThin
|
||||||
|
{
|
||||||
|
get { return vlnTable._LineThicknessForThin; }
|
||||||
|
set { vlnTable._LineThicknessForThin = value; }
|
||||||
|
}
|
||||||
|
private static float _LineThicknessForThick = 1.8F;
|
||||||
|
public static float LineThicknessForThick
|
||||||
|
{
|
||||||
|
get { return vlnTable._LineThicknessForThick; }
|
||||||
|
set { vlnTable._LineThicknessForThick = value; }
|
||||||
|
}
|
||||||
|
private static float _LineThicknessForDouble = .6F;
|
||||||
|
public static float LineThicknessForDouble
|
||||||
|
{
|
||||||
|
get { return vlnTable._LineThicknessForDouble; }
|
||||||
|
set { vlnTable._LineThicknessForDouble = value; }
|
||||||
|
}
|
||||||
|
public static float DoubleLineOffset
|
||||||
|
{
|
||||||
|
get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; }
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
|
public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
|
||||||
@ -66,7 +106,7 @@ namespace Volian.Print.Library
|
|||||||
RowTop = new float[MyFlexGrid.Rows.Count + 1];
|
RowTop = new float[MyFlexGrid.Rows.Count + 1];
|
||||||
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
|
||||||
? MyFlexGrid.Rows.DefaultSize : MyFlexGrid.Rows[r].Height) / (float)MyFlexGrid.DPI;
|
? MyFlexGrid.Rows.DefaultSize : MyFlexGrid.Rows[r].Height) / (float)MyFlexGrid.DPI;
|
||||||
ColLeft = new float[MyFlexGrid.Cols.Count + 1];
|
ColLeft = new float[MyFlexGrid.Cols.Count + 1];
|
||||||
ColLeft[0] = 0;
|
ColLeft[0] = 0;
|
||||||
@ -84,8 +124,14 @@ 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);
|
||||||
MyCells.ToPdf(myColumnText, left, top);
|
MyCells.ToPdf(myColumnText, left, top);
|
||||||
}
|
}
|
||||||
|
private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
||||||
|
{
|
||||||
|
PdfDestination dest = new PdfDestination(PdfDestination.FITR, left - 4, top + 4 - Height, left + Width, top + 4);
|
||||||
|
myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), left, top - Height, left + Width, top);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public class vlnCells : List<vlnCell>
|
public class vlnCells : List<vlnCell>
|
||||||
@ -134,7 +180,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
|
float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
|
||||||
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1];
|
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1];
|
||||||
string str = MyFlexGrid.GetCellRTFString(r, c)??string.Empty;
|
string str = MyFlexGrid.GetCellRTFString(r, c) ?? string.Empty;
|
||||||
DisplayText dt = new DisplayText(MyFlexGrid.MyItemInfo, str, false);
|
DisplayText dt = new DisplayText(MyFlexGrid.MyItemInfo, str, false);
|
||||||
str = dt.StartText;
|
str = dt.StartText;
|
||||||
using (StepRTB myRTB = new StepRTB())
|
using (StepRTB myRTB = new StepRTB())
|
||||||
@ -192,6 +238,10 @@ namespace Volian.Print.Library
|
|||||||
get { return _MyTable; }
|
get { return _MyTable; }
|
||||||
set { _MyTable = value; }
|
set { _MyTable = value; }
|
||||||
}
|
}
|
||||||
|
public VlnBorders MyBorders
|
||||||
|
{
|
||||||
|
get { return _MyTable.MyBorders; }
|
||||||
|
}
|
||||||
private int _r1;
|
private int _r1;
|
||||||
public int r1
|
public int r1
|
||||||
{
|
{
|
||||||
@ -229,6 +279,265 @@ namespace Volian.Print.Library
|
|||||||
set { _HContent = value; }
|
set { _HContent = value; }
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region Line Pattern Diagram
|
||||||
|
/*
|
||||||
|
The diagram below identifies the various border names for the cell in the center
|
||||||
|
|
||||||
|
|-AboveLeftSide |-AboveRightSide
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
LeftOfTopSide | TopSide | RightOfTopSide
|
||||||
|
------------------|-------------------|------------------
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
|-LeftSide |-RightSide
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
LeftOfBottomSide | BottomSide | RightOfBottomSide
|
||||||
|
--------------------------------------|------------------
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
|-BelowLeftSide |-BelowRightSide
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region Horizontal Line Patterns
|
||||||
|
private GridLinePattern _TopSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern TopSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_TopSide == GridLinePattern.Unknown)
|
||||||
|
_TopSide = MyBorders.HorizontalLines[r1, c1];
|
||||||
|
return _TopSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _BottomSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern BottomSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_BottomSide == GridLinePattern.Unknown)
|
||||||
|
_BottomSide = MyBorders.HorizontalLines[r2 + 1, c2];
|
||||||
|
return _BottomSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _RightOfTopSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern RightOfTopSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_RightOfTopSide == GridLinePattern.Unknown)
|
||||||
|
{
|
||||||
|
if (c2 == MyTable.MyFlexGrid.Cols.Count - 1)
|
||||||
|
_RightOfTopSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1, c2 + 1);
|
||||||
|
if (cr.r1 == r1)
|
||||||
|
_RightOfTopSide = MyBorders.HorizontalLines[r1, c2 + 1];
|
||||||
|
else
|
||||||
|
_RightOfTopSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _RightOfTopSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _LeftOfTopSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern LeftOfTopSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_LeftOfTopSide == GridLinePattern.Unknown)
|
||||||
|
{
|
||||||
|
if (c1 == 0)
|
||||||
|
_LeftOfTopSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This property is only used if c1==0 or r1==0:
|
||||||
|
// A merged range for row = 0 will always return an r1=0.
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1, c1 - 1);
|
||||||
|
if (cr.r1 == r1)
|
||||||
|
_LeftOfTopSide = MyBorders.HorizontalLines[r1, c1 - 1];
|
||||||
|
else // Since this section of code is only entered when r1==0, this else condition should never happen
|
||||||
|
_LeftOfTopSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _LeftOfTopSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _RightOfBottomSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern RightOfBottomSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_RightOfBottomSide == GridLinePattern.Unknown) // Need to consider Merged Cells
|
||||||
|
{
|
||||||
|
if (c2 == MyTable.MyFlexGrid.Cols.Count - 1)
|
||||||
|
_RightOfBottomSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2, c2 + 1);
|
||||||
|
if (cr.r2 == r2)
|
||||||
|
_RightOfBottomSide = MyBorders.HorizontalLines[r2 + 1, c2 + 1];
|
||||||
|
else
|
||||||
|
_RightOfBottomSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _RightOfBottomSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _LeftOfBottomSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern LeftOfBottomSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_LeftOfBottomSide == GridLinePattern.Unknown) // Need to consider Merged Cells
|
||||||
|
{
|
||||||
|
if (c1 == 0)
|
||||||
|
_LeftOfBottomSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2, c1 - 1);
|
||||||
|
if (cr.r2 == r2)
|
||||||
|
_LeftOfBottomSide = MyBorders.HorizontalLines[r2 + 1, c1 - 1];
|
||||||
|
else
|
||||||
|
_LeftOfBottomSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _LeftOfBottomSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Vertical Line Patterns
|
||||||
|
private GridLinePattern _LeftSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern LeftSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_LeftSide == GridLinePattern.Unknown)
|
||||||
|
_LeftSide = MyBorders.VerticalLines[r1, c1];
|
||||||
|
return _LeftSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _RightSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern RightSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_RightSide == GridLinePattern.Unknown)
|
||||||
|
_RightSide = MyBorders.VerticalLines[r2, c2 + 1];
|
||||||
|
return _RightSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _BelowRightSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern BelowRightSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_BelowRightSide == GridLinePattern.Unknown)
|
||||||
|
{
|
||||||
|
if (r2 == MyTable.MyFlexGrid.Rows.Count - 1)
|
||||||
|
_BelowRightSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2 + 1, c2);
|
||||||
|
if (cr.c2 == c2)
|
||||||
|
_BelowRightSide = MyBorders.VerticalLines[r2 + 1, c2 + 1];
|
||||||
|
else
|
||||||
|
_BelowRightSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _BelowRightSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _AboveRightSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern AboveRightSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_AboveRightSide == GridLinePattern.Unknown)
|
||||||
|
{
|
||||||
|
if (r1 == 0)
|
||||||
|
_AboveRightSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1 - 1, c2);
|
||||||
|
if (cr.c2 == c2)
|
||||||
|
_AboveRightSide = MyBorders.VerticalLines[r1 - 1, c2 + 1];
|
||||||
|
else
|
||||||
|
_AboveRightSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _AboveRightSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _BelowLeftSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern BelowLeftSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_BelowLeftSide == GridLinePattern.Unknown)
|
||||||
|
{
|
||||||
|
if (r2 == MyTable.MyFlexGrid.Rows.Count - 1)
|
||||||
|
_BelowLeftSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2 + 1, c1);
|
||||||
|
if (cr.c1 == c1)
|
||||||
|
_BelowLeftSide = MyBorders.VerticalLines[r2 + 1, c1];
|
||||||
|
else
|
||||||
|
_BelowLeftSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _BelowLeftSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GridLinePattern _AboveLeftSide = GridLinePattern.Unknown;
|
||||||
|
public GridLinePattern AboveLeftSide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_AboveLeftSide == GridLinePattern.Unknown)
|
||||||
|
{
|
||||||
|
if (r1 == 0)
|
||||||
|
_AboveLeftSide = GridLinePattern.None;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This property is only used if c1==0 or r1==0:
|
||||||
|
// A merged range for col = 0 will always return an c1=0.
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1 - 1, c1);
|
||||||
|
if (cr.c1 == c1)
|
||||||
|
_AboveLeftSide = MyBorders.VerticalLines[r1 - 1, c1];
|
||||||
|
else // Since this section of code is only entered when c1==0, this else condition should never happen
|
||||||
|
_AboveLeftSide = GridLinePattern.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _AboveLeftSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Static Properties
|
||||||
|
private static float XOffset { get { return vlnTable.XOffset; } }
|
||||||
|
private static float YOffset { get { return vlnTable.YOffset; } }
|
||||||
|
private static float LineThicknessForThin { get { return vlnTable.LineThicknessForThin; } }
|
||||||
|
private static float LineThicknessForThick { get { return vlnTable.LineThicknessForThick; } }
|
||||||
|
private static float LineThicknessForDouble { get { return vlnTable.LineThicknessForDouble; } }
|
||||||
|
private static float DoubleLineOffset { get { return vlnTable.DoubleLineOffset; } }
|
||||||
|
|
||||||
|
// adjustments for line intersections:
|
||||||
|
private static float ThickOverDouble { get { return ((2 * DoubleLineOffset) + LineThicknessForDouble - LineThicknessForThick) / 2; } }
|
||||||
|
private static float ThickUnderDouble { get { return DoubleLineOffset + (LineThicknessForThick - LineThicknessForDouble) / 2; } }
|
||||||
|
private static float ThickOverThin { get { return (LineThicknessForThin - LineThicknessForThick) / 2; } }
|
||||||
|
private static float ThinOverThick { get { return (LineThicknessForThick - LineThicknessForThin) / 2; } }
|
||||||
|
private static float ThinUnderDouble { get { return DoubleLineOffset + (LineThicknessForThin - LineThicknessForDouble) / 2; } }
|
||||||
|
private static float ThinOverDouble { get { return (DoubleLineOffset + LineThicknessForThin - LineThicknessForDouble) / 2; } }
|
||||||
|
private static float DoubleUnderThin { get { return (LineThicknessForThin - LineThicknessForDouble) / 2; } }
|
||||||
|
private static float DoubleUnderThick { get { return (LineThicknessForThick - LineThicknessForDouble) / 2; } }
|
||||||
|
#endregion
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public vlnCell(int r1, int c1, int r2, int c2, vlnTable myTable, iTextSharp.text.Paragraph myPara, float hContent)
|
public vlnCell(int r1, int c1, int r2, int c2, vlnTable myTable, iTextSharp.text.Paragraph myPara, float hContent)
|
||||||
{
|
{
|
||||||
@ -253,26 +562,20 @@ namespace Volian.Print.Library
|
|||||||
float w = MyTable.ColLeft[c2 + 1] - x;
|
float w = MyTable.ColLeft[c2 + 1] - x;
|
||||||
float y = MyTable.RowTop[r1];
|
float y = MyTable.RowTop[r1];
|
||||||
float h = MyTable.RowTop[r2 + 1] - y;
|
float h = MyTable.RowTop[r2 + 1] - y;
|
||||||
CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
BordersToPdf(myColumnText, left, top, x, w, y, h);
|
||||||
if (cr.Style == null || cr.Style.Border.Style != BorderStyleEnum.None)
|
float hAdjust = VeritcalTextAlignment(h);
|
||||||
{
|
iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas);
|
||||||
myColumnText.Canvas.Rectangle(left + x, top - y, w, -h);
|
myColumnText1.SetSimpleColumn(1 + left + x, top - y - h, left + x + w, 1 + top - y - hAdjust); // 2 == Default Padding
|
||||||
iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
myColumnText1.AddElement(MyPara);
|
||||||
myColumnText.Canvas.SetColorStroke(lineColor);
|
myColumnText1.Go();
|
||||||
myColumnText.Canvas.SetLineWidth(.5F);
|
myColumnText.Canvas.RestoreState();
|
||||||
if (cr.Style != null && cr.Style.Border.Style == BorderStyleEnum.Dotted)
|
}
|
||||||
{
|
#endregion
|
||||||
myColumnText.Canvas.SetLineCap(iTextSharp.text.pdf.PdfContentByte.LINE_CAP_ROUND);
|
#region Private Text Methods
|
||||||
myColumnText.Canvas.SetLineDash(0, 2, 0);
|
private float VeritcalTextAlignment(float h)
|
||||||
//myColumnText.Canvas.SetLineDash(10, 5, 0);
|
{
|
||||||
//float[] myDashPattern ={ 1, 2, 3, 4, 5, 6, 7, 8 };
|
|
||||||
//myColumnText.Canvas.SetLineDash(myDashPattern, 0);
|
|
||||||
}
|
|
||||||
else if (cr.Style != null && cr.Style.Border.Style == BorderStyleEnum.Fillet)
|
|
||||||
myColumnText.Canvas.SetLineDash(4, 4, 0);
|
|
||||||
myColumnText.Canvas.Stroke();
|
|
||||||
}
|
|
||||||
float hAdjust = 0;
|
float hAdjust = 0;
|
||||||
|
CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
||||||
if (cr.Style != null)
|
if (cr.Style != null)
|
||||||
{
|
{
|
||||||
switch (cr.Style.TextAlign)
|
switch (cr.Style.TextAlign)
|
||||||
@ -293,13 +596,406 @@ namespace Volian.Print.Library
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas);
|
return hAdjust;
|
||||||
myColumnText1.SetSimpleColumn(1 + left + x, top - y - h, left + x + w, 1 + top - y - hAdjust); // 2 == Default Padding
|
|
||||||
myColumnText1.AddElement(MyPara);
|
|
||||||
myColumnText1.Go();
|
|
||||||
myColumnText.Canvas.RestoreState();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
#region Private Border Methods
|
||||||
|
// coordinate system is upside down of screen. 0,0 on screen is top/left. 0,0 on pdf is bottom/left.
|
||||||
|
// i.e. x is same, y is flipped.
|
||||||
|
private void BordersToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, float x, float w, float y, float h)
|
||||||
|
{
|
||||||
|
PdfContentByte cb = myColumnText.Canvas;
|
||||||
|
cb.SaveState();// Save state before drawing borders
|
||||||
|
SetOpacity(cb, .7F); // This line makes the borders transparent for testing
|
||||||
|
float xLeft = left + x + XOffset;
|
||||||
|
float yTop = top - y + YOffset;
|
||||||
|
float xRight = left + x + w + XOffset;
|
||||||
|
float yBottom = top - y - h + YOffset;
|
||||||
|
// ZoomToCell(myColumnText, xLeft, yTop, xRight, yBottom);
|
||||||
|
// Draw Top Side for the first row
|
||||||
|
if (r1 == 0)
|
||||||
|
DrawHorizontalLine(cb, "Top", xLeft, xRight, yTop, TopSide, LeftSide, AboveLeftSide, LeftOfTopSide, AboveRightSide, RightSide, RightOfTopSide);
|
||||||
|
// Draw Left Side for the first column
|
||||||
|
if (c1 == 0)
|
||||||
|
DrawLineVertical(cb, "Left", xLeft, yBottom, yTop, LeftSide, BottomSide, LeftOfBottomSide, BelowLeftSide, LeftOfTopSide, TopSide, AboveLeftSide);
|
||||||
|
// Draw Bottom Side
|
||||||
|
DrawHorizontalLine(cb, "Bottom", xLeft, xRight, yBottom, BottomSide, BelowLeftSide, LeftSide, LeftOfBottomSide, RightSide, BelowRightSide, RightOfBottomSide);
|
||||||
|
// Draw Right Side
|
||||||
|
DrawLineVertical(cb, "Right", xRight, yBottom, yTop, RightSide, RightOfBottomSide, BottomSide, BelowRightSide, TopSide, RightOfTopSide, AboveRightSide);
|
||||||
|
cb.RestoreState();
|
||||||
|
}
|
||||||
|
private void DrawHorizontalLine(PdfContentByte cb, string side, float xStart, float xEnd, float y, GridLinePattern LinePattern,
|
||||||
|
GridLinePattern startToLeft, GridLinePattern startToRight, GridLinePattern startAhead,
|
||||||
|
GridLinePattern endToLeft, GridLinePattern endToRight, GridLinePattern endAhead)
|
||||||
|
{
|
||||||
|
if (LinePattern != GridLinePattern.None)
|
||||||
|
{
|
||||||
|
InitializeLineStyle(cb);
|
||||||
|
SetLineColor(cb, r1, c1, side);
|
||||||
|
if (LinePattern == GridLinePattern.Double)
|
||||||
|
{
|
||||||
|
// Top Line
|
||||||
|
float dStart = -DoubleIntersectionRight(startToLeft, startToRight, startAhead);
|
||||||
|
float dEnd = DoubleIntersectionLeft(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForDouble, xStart + dStart, y + DoubleLineOffset, xEnd + dEnd, y + DoubleLineOffset);
|
||||||
|
// Bottom Line
|
||||||
|
dStart = -DoubleIntersectionLeft(startToLeft, startToRight, startAhead);
|
||||||
|
dEnd = DoubleIntersectionRight(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForDouble, xStart + dStart, y - DoubleLineOffset, xEnd + dEnd, y - DoubleLineOffset);
|
||||||
|
}
|
||||||
|
else if (LinePattern != GridLinePattern.Thick)
|
||||||
|
{
|
||||||
|
SetLinePattern(cb, LinePattern);
|
||||||
|
float dStart = -ThinIntersection(startToLeft, startToRight, startAhead);
|
||||||
|
float dEnd = ThinIntersection(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForThin, xStart + dStart, y, xEnd + dEnd, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float dStart = -ThickIntersection(startToLeft, startToRight, startAhead);
|
||||||
|
float dEnd = ThickIntersection(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForThick, xStart + dStart, y, xEnd + dEnd, y);
|
||||||
|
}
|
||||||
|
cb.Stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DrawLineVertical(PdfContentByte cb, string side, float x, float yStart, float yEnd, GridLinePattern LinePattern,
|
||||||
|
GridLinePattern startToLeft, GridLinePattern startToRight, GridLinePattern startAhead,
|
||||||
|
GridLinePattern endToLeft, GridLinePattern endToRight, GridLinePattern endAhead)
|
||||||
|
{
|
||||||
|
if (LinePattern != GridLinePattern.None)
|
||||||
|
{
|
||||||
|
InitializeLineStyle(cb);
|
||||||
|
SetLineColor(cb, r1, c1, side);
|
||||||
|
if (LinePattern == GridLinePattern.Double)
|
||||||
|
{
|
||||||
|
//Left Line
|
||||||
|
float dStart = -DoubleIntersectionRight(startToLeft, startToRight, startAhead);
|
||||||
|
float dEnd = DoubleIntersectionLeft(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForDouble, x - DoubleLineOffset, yStart + dStart, x - DoubleLineOffset, yEnd + dEnd);
|
||||||
|
//Right Line
|
||||||
|
dStart = -DoubleIntersectionLeft(startToLeft, startToRight, startAhead);
|
||||||
|
dEnd = DoubleIntersectionRight(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForDouble, x + DoubleLineOffset, yStart + dStart, x + DoubleLineOffset, yEnd + dEnd);
|
||||||
|
}
|
||||||
|
else if (LinePattern != GridLinePattern.Thick)
|
||||||
|
{
|
||||||
|
SetLinePattern(cb, LinePattern);
|
||||||
|
float dStart = -ThinIntersection(startToLeft, startToRight, startAhead);
|
||||||
|
float dEnd = ThinIntersection(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForThin, x, yStart + dStart, x, yEnd + dEnd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float dStart = -ThickIntersection(startToLeft, startToRight, startAhead);
|
||||||
|
float dEnd = ThickIntersection(endToLeft, endToRight, endAhead);
|
||||||
|
DrawLine(cb, LineThicknessForThick, x, yStart + dStart, x, yEnd + dEnd);
|
||||||
|
}
|
||||||
|
cb.Stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Intersection Diagram
|
||||||
|
/* driving into an intersection on line being drawn, facing the intersection. Each intersection requires
|
||||||
|
* drawing of each of the four cases:
|
||||||
|
|
||||||
|
Case 1: Line being drawn right:
|
||||||
|
|
||||||
|
lineToLeft
|
||||||
|
^
|
||||||
|
|
|
||||||
|
Line Being Drawn ----->|---> LineAhead
|
||||||
|
|
|
||||||
|
v
|
||||||
|
lineToRight
|
||||||
|
|
||||||
|
|
||||||
|
Case 2: Line being drawn left:
|
||||||
|
|
||||||
|
lineToRight
|
||||||
|
^
|
||||||
|
|
|
||||||
|
LineAhead <-----|<--- Line Being Drawn
|
||||||
|
|
|
||||||
|
v
|
||||||
|
lineToLeft
|
||||||
|
|
||||||
|
Case 3: Line being drawn up:
|
||||||
|
|
||||||
|
lineAhead
|
||||||
|
^
|
||||||
|
|
|
||||||
|
lineToLeft <-----|----> lineToRight
|
||||||
|
^
|
||||||
|
|
|
||||||
|
|
|
||||||
|
Line Being Drawn
|
||||||
|
|
||||||
|
|
||||||
|
Case 4: Line being drawn down:
|
||||||
|
|
||||||
|
Line Begin Drawn
|
||||||
|
|
|
||||||
|
|
|
||||||
|
v
|
||||||
|
lineToRight <-----|----> lineToLeft
|
||||||
|
|
|
||||||
|
|
|
||||||
|
v
|
||||||
|
lineAhead
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
#region Border Intersection Methods
|
||||||
|
private static float DoubleIntersectionLeft(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead)
|
||||||
|
{
|
||||||
|
if (lineToLeft == GridLinePattern.Double)
|
||||||
|
return -DoubleLineOffset;
|
||||||
|
if (lineToRight == GridLinePattern.Double || lineAhead == GridLinePattern.Double)
|
||||||
|
return DoubleLineOffset;
|
||||||
|
if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick)
|
||||||
|
return DoubleUnderThick;
|
||||||
|
if (VlnBorders.LineWidth(lineToLeft) == 1 || VlnBorders.LineWidth(lineToRight) == 1)
|
||||||
|
return DoubleUnderThin;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
private static float DoubleIntersectionRight(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead)
|
||||||
|
{
|
||||||
|
if (lineToRight == GridLinePattern.Double)
|
||||||
|
return -DoubleLineOffset;
|
||||||
|
if (lineToLeft == GridLinePattern.Double || lineAhead == GridLinePattern.Double)
|
||||||
|
return DoubleLineOffset;
|
||||||
|
if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick)
|
||||||
|
return DoubleUnderThick;
|
||||||
|
if (VlnBorders.LineWidth(lineToLeft) == 1 || VlnBorders.LineWidth(lineToRight) == 1)
|
||||||
|
return DoubleUnderThin;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
private static float ThinIntersection(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead)
|
||||||
|
{
|
||||||
|
if (lineToLeft == GridLinePattern.Double && lineToRight == GridLinePattern.Double)
|
||||||
|
return -ThinUnderDouble;
|
||||||
|
if (lineToLeft == GridLinePattern.Double || lineToRight == GridLinePattern.Double)
|
||||||
|
{
|
||||||
|
if (lineAhead == GridLinePattern.Double) return -ThinUnderDouble;
|
||||||
|
return ThinOverDouble;
|
||||||
|
}
|
||||||
|
if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick)
|
||||||
|
return ThinOverThick;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
private static float ThickIntersection(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead)
|
||||||
|
{
|
||||||
|
if (lineToLeft == GridLinePattern.Double && lineToRight == GridLinePattern.Double)
|
||||||
|
{
|
||||||
|
if (lineAhead == GridLinePattern.Thick) return ThickOverDouble;
|
||||||
|
return -ThickUnderDouble;
|
||||||
|
}
|
||||||
|
if (lineToLeft == GridLinePattern.Double || lineToRight == GridLinePattern.Double)
|
||||||
|
{
|
||||||
|
if (lineAhead == GridLinePattern.Double) return -ThickUnderDouble;
|
||||||
|
return ThickOverDouble;
|
||||||
|
}
|
||||||
|
if (VlnBorders.LineWidth(lineToLeft) == 1 && VlnBorders.LineWidth(lineToRight) == 1)
|
||||||
|
return ThickOverThin;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Basic Border Methods
|
||||||
|
private static void DrawLine(PdfContentByte cb, float lineThickness, float xStart, float yStart, float xEnd, float yEnd)
|
||||||
|
{
|
||||||
|
cb.SetLineWidth(lineThickness);
|
||||||
|
cb.MoveTo(xStart, yStart);
|
||||||
|
cb.LineTo(xEnd, yEnd);
|
||||||
|
}
|
||||||
|
private static void SetLinePattern(PdfContentByte cb, GridLinePattern linePattern)
|
||||||
|
{
|
||||||
|
if (linePattern == GridLinePattern.Dotted)
|
||||||
|
{
|
||||||
|
cb.SetLineDash(0, 2, 0);
|
||||||
|
cb.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
|
||||||
|
}
|
||||||
|
else if (linePattern == GridLinePattern.Dashed)
|
||||||
|
cb.SetLineDash(4, 4, 0);
|
||||||
|
}
|
||||||
|
private static void SetLineColor(PdfContentByte cb, int row, int col, string side)
|
||||||
|
{
|
||||||
|
iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||||
|
switch (side)
|
||||||
|
{
|
||||||
|
case "Top":
|
||||||
|
if (col == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Blue));
|
||||||
|
else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Cyan));
|
||||||
|
break;
|
||||||
|
case "Left":
|
||||||
|
if (row == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Red));
|
||||||
|
else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Magenta));
|
||||||
|
break;
|
||||||
|
case "Bottom":
|
||||||
|
if (col == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Green));
|
||||||
|
else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Cyan));
|
||||||
|
break;
|
||||||
|
case "Right":
|
||||||
|
if (row == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Orange));
|
||||||
|
else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Magenta));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cb.SetColorStroke(lineColor);
|
||||||
|
}
|
||||||
|
private static void InitializeLineStyle(PdfContentByte cb)
|
||||||
|
{
|
||||||
|
cb.SetLineCap(PdfContentByte.LINE_CAP_PROJECTING_SQUARE); // Extend the line by half of it's thickness
|
||||||
|
cb.SetLineDash(0);// Solid Line
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Debug Methods
|
||||||
|
private static void SetOpacity(PdfContentByte cb, float opacity)
|
||||||
|
{
|
||||||
|
PdfGState gs = new PdfGState();
|
||||||
|
gs.StrokeOpacity = opacity;
|
||||||
|
cb.SetGState(gs);
|
||||||
|
}
|
||||||
|
private static void ZoomToCell(iTextSharp.text.pdf.ColumnText myColumnText, float xLeft, float yTop, float xRight, float yBottom)
|
||||||
|
{
|
||||||
|
PdfDestination dest = new PdfDestination(PdfDestination.FITR, xLeft - 4, yBottom + 4, xRight, yTop + 4);
|
||||||
|
myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), xLeft, yBottom, xRight, yTop);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Old Border Methods
|
||||||
|
//private void DrawLeftLine(PdfContentByte cb, float xLeft, float yTop, float yBottom)
|
||||||
|
//{
|
||||||
|
// if (c1 == 0 && LineLeft != GridLinePattern.None)
|
||||||
|
// {
|
||||||
|
// InitializeLineStyle(cb);
|
||||||
|
// SetLineColor(cb, r1, c1, "Left");
|
||||||
|
// if (LineLeft == GridLinePattern.Double)
|
||||||
|
// {
|
||||||
|
// //Left Line
|
||||||
|
// float dyTop = DoubleIntersectionLeft(LineTopLeft, LineTop, LineLeftAbove);
|
||||||
|
// float dyBottom = -DoubleIntersectionRight(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xLeft - DoubleLineOffset, yTop + dyTop, xLeft - DoubleLineOffset, yBottom + dyBottom);
|
||||||
|
// //Right Line
|
||||||
|
// dyTop = DoubleIntersectionRight(LineTopLeft, LineTop, LineLeftAbove);
|
||||||
|
// dyBottom = -DoubleIntersectionLeft(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xLeft + DoubleLineOffset, yTop + dyTop, xLeft + DoubleLineOffset, yBottom + dyBottom);
|
||||||
|
// }
|
||||||
|
// else if (LineLeft != GridLinePattern.Thick)
|
||||||
|
// {
|
||||||
|
// SetLinePattern(cb, LineLeft);
|
||||||
|
// float dyTop = ThinIntersection(LineTopLeft, LineTop, LineLeftAbove);
|
||||||
|
// float dyBottom = -ThinIntersection(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForThin, xLeft, yTop + dyTop, xLeft, yBottom + dyBottom);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// float dyTop = ThickIntersection(LineTopLeft, LineTop, LineLeftAbove);
|
||||||
|
// float dyBottom = -ThickIntersection(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForThick, xLeft, yTop + dyTop, xLeft, yBottom + dyBottom);
|
||||||
|
// }
|
||||||
|
// cb.Stroke();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//private void DrawRightLine(PdfContentByte cb, float xRight, float yTop, float yBottom)
|
||||||
|
//{
|
||||||
|
// if (LineRight != GridLinePattern.None)
|
||||||
|
// {
|
||||||
|
// InitializeLineStyle(cb);
|
||||||
|
// SetLineColor(cb, r1, c1, "Right");
|
||||||
|
// if (LineRight == GridLinePattern.Double)
|
||||||
|
// {
|
||||||
|
// //Left Line
|
||||||
|
// float dyTop = DoubleIntersectionLeft(LineTop, LineTopRight, LineRightAbove);
|
||||||
|
// float dyBottom = -DoubleIntersectionRight(LineBottomRight, LineBottom, LineRightBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xRight - DoubleLineOffset, yTop + dyTop, xRight - DoubleLineOffset, yBottom + dyBottom);
|
||||||
|
// //Right Line
|
||||||
|
// dyTop = DoubleIntersectionRight(LineTop, LineTopRight, LineRightAbove);
|
||||||
|
// dyBottom = -DoubleIntersectionLeft(LineBottomRight, LineBottom, LineRightBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xRight + DoubleLineOffset, yTop + dyTop, xRight + DoubleLineOffset, yBottom + dyBottom);
|
||||||
|
// }
|
||||||
|
// else if (LineRight != GridLinePattern.Thick)
|
||||||
|
// {
|
||||||
|
// float dyTop = ThinIntersection(LineTop, LineTopRight, LineRightAbove);
|
||||||
|
// float dyBottom = -ThinIntersection(LineBottomRight, LineBottom, LineRightBelow);
|
||||||
|
// SetLinePattern(cb, LineRight);
|
||||||
|
// DrawLine(cb, LineThicknessForThin, xRight, yTop + dyTop, xRight, yBottom + dyBottom);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// float dyTop = ThickIntersection(LineTop, LineTopRight, LineRightAbove);
|
||||||
|
// float dyBottom = -ThickIntersection(LineBottomRight, LineBottom, LineRightBelow);
|
||||||
|
// DrawLine(cb, LineThicknessForThick, xRight, yTop + dyTop, xRight, yBottom + dyBottom);
|
||||||
|
// }
|
||||||
|
// cb.Stroke();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//private void DrawTopLine(PdfContentByte cb, float xLeft, float xRight, float yTop)
|
||||||
|
//{
|
||||||
|
// if (r1 == 0 && TopSide != GridLinePattern.None)
|
||||||
|
// {
|
||||||
|
// InitializeLineStyle(cb);
|
||||||
|
// SetLineColor(cb, r1, c1, "Top");
|
||||||
|
// if (TopSide == GridLinePattern.Double)
|
||||||
|
// {
|
||||||
|
// // Top Line
|
||||||
|
// float dxLeft = -DoubleIntersectionRight(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||||
|
// float dxRight = DoubleIntersectionLeft(AboveRightSide, RightSide, RightOfTopSide);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yTop + DoubleLineOffset, xRight + dxRight, yTop + DoubleLineOffset);
|
||||||
|
// // Bottom Line
|
||||||
|
// dxLeft = -DoubleIntersectionLeft(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||||
|
// dxRight = DoubleIntersectionRight(AboveRightSide, RightSide, RightOfTopSide);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yTop - DoubleLineOffset, xRight + dxRight, yTop - DoubleLineOffset);
|
||||||
|
// }
|
||||||
|
// else if (TopSide != GridLinePattern.Thick)
|
||||||
|
// {
|
||||||
|
// SetLinePattern(cb, TopSide);
|
||||||
|
// float dxLeft = -ThinIntersection(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||||
|
// float dxRight = ThinIntersection(AboveRightSide, RightSide, RightOfTopSide);
|
||||||
|
// DrawLine(cb, LineThicknessForThin, xLeft + dxLeft, yTop, xRight + dxRight, yTop);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// float dxLeft = -ThickIntersection(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||||
|
// float dxRight = ThickIntersection(AboveRightSide, RightSide, RightOfTopSide);
|
||||||
|
// if (c1 == 0)
|
||||||
|
// Console.WriteLine("'{0}','{1}','{2}',{3},{4}", LeftSide, AboveLeftSide, LeftOfTopSide, dxLeft, ThickOverThin);
|
||||||
|
// DrawLine(cb, LineThicknessForThick, xLeft + dxLeft, yTop, xRight + dxRight, yTop);
|
||||||
|
// }
|
||||||
|
// cb.Stroke();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//private void DrawBottomLine(PdfContentByte cb, float xLeft, float xRight, float yBottom)
|
||||||
|
//{
|
||||||
|
// if (BottomSide != GridLinePattern.None)
|
||||||
|
// {
|
||||||
|
// InitializeLineStyle(cb);
|
||||||
|
// SetLineColor(cb, r1, c1, "Bottom");
|
||||||
|
// if (BottomSide == GridLinePattern.Double)
|
||||||
|
// {
|
||||||
|
// // Top Line
|
||||||
|
// float dxLeft = -DoubleIntersectionRight(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||||
|
// float dxRight = DoubleIntersectionLeft(RightSide, BelowRightSide, RightOfBottomSide);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yBottom + DoubleLineOffset, xRight + dxRight, yBottom + DoubleLineOffset);// Top Line
|
||||||
|
// // Bottom Line
|
||||||
|
// dxLeft = -DoubleIntersectionLeft(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||||
|
// dxRight = DoubleIntersectionRight(RightSide, BelowRightSide, RightOfBottomSide);
|
||||||
|
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yBottom - DoubleLineOffset, xRight + dxRight, yBottom - DoubleLineOffset);//Bottom Line
|
||||||
|
// }
|
||||||
|
// else if (BottomSide != GridLinePattern.Thick) // Bottom line is thin. Determine if intersecting with double:
|
||||||
|
// {
|
||||||
|
// SetLinePattern(cb, BottomSide);
|
||||||
|
// float dxLeft = -ThinIntersection(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||||
|
// float dxRight = ThinIntersection(RightSide, BelowRightSide, RightOfBottomSide);
|
||||||
|
// DrawLine(cb, LineThicknessForThin, xLeft + dxLeft, yBottom, xRight + dxRight, yBottom);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// float dxLeft = -ThickIntersection(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||||
|
// float dxRight = ThickIntersection(RightSide, BelowRightSide, RightOfBottomSide);
|
||||||
|
// DrawLine(cb, LineThicknessForThick, xLeft + dxLeft, yBottom, xRight + dxRight, yBottom);
|
||||||
|
// }
|
||||||
|
// cb.Stroke();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user