Exemple #1
0
        protected internal override TableBorders DrawVerticalBorder(int i, float startY, float x1, PdfCanvas canvas
                                                                    , IList <float> heights)
        {
            IList <Border> borders = GetVerticalBorder(i);
            float          y1      = startY;
            float          y2      = y1;

            if (!heights.IsEmpty())
            {
                y2 = y1 - (float)heights[0];
            }
            int j;

            for (j = 1; j < heights.Count; j++)
            {
                Border prevBorder = borders[startRow - largeTableIndexOffset + j - 1];
                Border curBorder  = borders[startRow - largeTableIndexOffset + j];
                if (prevBorder != null)
                {
                    if (!prevBorder.Equals(curBorder))
                    {
                        prevBorder.DrawCellBorder(canvas, x1, y1, x1, y2, Border.Side.NONE);
                        y1 = y2;
                    }
                }
                else
                {
                    y1 -= (float)heights[j - 1];
                    y2  = y1;
                }
                if (curBorder != null)
                {
                    y2 -= (float)heights[j];
                }
            }
            if (borders.Count == 0)
            {
                return(this);
            }
            Border lastBorder = borders[startRow - largeTableIndexOffset + j - 1];

            if (lastBorder != null)
            {
                lastBorder.DrawCellBorder(canvas, x1, y1, x1, y2, Border.Side.NONE);
            }
            return(this);
        }
Exemple #2
0
        // endregion
        // region draw
        protected internal override TableBorders DrawHorizontalBorder(int i, float startX, float y1, PdfCanvas canvas
                                                                      , float[] countedColumnWidth)
        {
            IList <Border> borders = GetHorizontalBorder(startRow + /*- largeTableIndexOffset*/ i);
            float          x1      = startX;
            float          x2      = x1 + countedColumnWidth[0];

            if (i == 0)
            {
                Border firstBorder = GetFirstVerticalBorder()[startRow - largeTableIndexOffset];
                if (firstBorder != null)
                {
                    x1 -= firstBorder.GetWidth() / 2;
                }
            }
            else
            {
                if (i == finishRow - startRow + 1)
                {
                    Border firstBorder = GetFirstVerticalBorder()[startRow - largeTableIndexOffset + finishRow - startRow + 1
                                                                  - 1];
                    if (firstBorder != null)
                    {
                        x1 -= firstBorder.GetWidth() / 2;
                    }
                }
            }
            int j;

            for (j = 1; j < borders.Count; j++)
            {
                Border prevBorder = borders[j - 1];
                Border curBorder  = borders[j];
                if (prevBorder != null)
                {
                    if (!prevBorder.Equals(curBorder))
                    {
                        prevBorder.DrawCellBorder(canvas, x1, y1, x2, y1, Border.Side.NONE);
                        x1 = x2;
                    }
                }
                else
                {
                    x1 += countedColumnWidth[j - 1];
                    x2  = x1;
                }
                if (curBorder != null)
                {
                    x2 += countedColumnWidth[j];
                }
            }
            Border lastBorder = borders.Count > j - 1 ? borders[j - 1] : null;

            if (lastBorder != null)
            {
                if (i == 0)
                {
                    if (GetVerticalBorder(j)[startRow - largeTableIndexOffset + i] != null)
                    {
                        x2 += GetVerticalBorder(j)[startRow - largeTableIndexOffset + i].GetWidth() / 2;
                    }
                }
                else
                {
                    if (i == finishRow - startRow + 1 && GetVerticalBorder(j).Count > startRow - largeTableIndexOffset + i - 1 &&
                        GetVerticalBorder(j)[startRow - largeTableIndexOffset + i - 1] != null)
                    {
                        x2 += GetVerticalBorder(j)[startRow - largeTableIndexOffset + i - 1].GetWidth() / 2;
                    }
                }
                lastBorder.DrawCellBorder(canvas, x1, y1, x2, y1, Border.Side.NONE);
            }
            return(this);
        }