Beispiel #1
0
 public void SetCellBordersColor(int color)
 {
     for (int i = 0; i < this.tableData.Count; i++)
     {
         List <AbstractCell> list = this.tableData[i];
         for (int j = 0; j < list.Count; j++)
         {
             AbstractCell abstractCell = this.tableData[i][j];
             abstractCell.SetPenColor(color);
         }
     }
 }
Beispiel #2
0
 public void SetCellBordersWidth(float width)
 {
     for (int i = 0; i < this.tableData.Count; i++)
     {
         List <AbstractCell> list = this.tableData[i];
         for (int j = 0; j < list.Count; j++)
         {
             AbstractCell abstractCell = this.tableData[i][j];
             abstractCell.SetLineWidth(width);
         }
     }
 }
Beispiel #3
0
 public void AutoAdjustColumnWidths(float tableWidth)
 {
     float[] array = new float[this.tableData[0].Count];
     foreach (List <AbstractCell> current in this.tableData)
     {
         for (int i = 0; i < current.Count; i++)
         {
             AbstractCell abstractCell = current[i];
             if (abstractCell.GetColSpan() == 1)
             {
                 abstractCell.ComputeWidth();
                 array[i] = Math.Max(array[i], abstractCell.GetWidth());
             }
         }
     }
     if (tableWidth > 0f)
     {
         float num = 0f;
         for (int j = 0; j < array.Length; j++)
         {
             num += array[j];
             if (num > tableWidth)
             {
                 array[j] = Math.Max(0f, array[j] - (num - tableWidth));
             }
         }
     }
     foreach (List <AbstractCell> current2 in this.tableData)
     {
         for (int k = 0; k < current2.Count; k++)
         {
             AbstractCell abstractCell2 = current2[k];
             if (abstractCell2.GetColSpan() <= 1)
             {
                 abstractCell2.SetWidth(array[k] + 3f * this.margin);
             }
             else
             {
                 float num2 = 0f;
                 int   num3 = k;
                 while (num3 < current2.Count && num3 < k + abstractCell2.GetColSpan())
                 {
                     num2 += array[num3];
                     num3++;
                 }
                 abstractCell2.SetWidth(num2 + 3f * this.margin);
             }
         }
     }
 }
Beispiel #4
0
        public Point DrawOn(Page page, bool draw)
        {
            float num  = this.x1;
            float num2 = this.y1;
            float num3 = 0f;

            for (int i = 0; i < this.numOfHeaderRows; i++)
            {
                num3 = 0f;
                List <AbstractCell> list = this.tableData[i];
                foreach (AbstractCell current in list)
                {
                    num3 = Math.Max(num3, current.GetComputedHeight(2f * this.margin) + 2f * this.margin);
                }
                for (int j = 0; j < list.Count; j++)
                {
                    AbstractCell abstractCell = list[j];
                    float        num4         = abstractCell.GetComputedHeight(2f * this.margin) + 2f * this.margin;
                    if (num4 > num3)
                    {
                        num3 = num4;
                    }
                    float num5    = abstractCell.GetWidth();
                    int   colSpan = abstractCell.GetColSpan();
                    for (int k = 1; k < colSpan; k++)
                    {
                        num5 += list[++j].GetWidth();
                    }
                    if (draw)
                    {
                        page.SetBrushColor(abstractCell.GetBrushColor());
                        abstractCell.Paint(page, num, num2, num5, num3, this.margin);
                    }
                    num += num5;
                }
                num   = this.x1;
                num2 += num3;
            }
            for (int l = this.rendered; l < this.tableData.Count; l++)
            {
                num3 = 0f;
                List <AbstractCell> list2 = this.tableData[l];
                foreach (AbstractCell current2 in list2)
                {
                    num3 = Math.Max(num3, current2.GetComputedHeight(2f * this.margin) + 2f * this.margin);
                }
                for (int m = 0; m < list2.Count; m++)
                {
                    AbstractCell abstractCell2 = list2[m];
                    float        num5          = abstractCell2.GetWidth();
                    int          colSpan2      = abstractCell2.GetColSpan();
                    for (int n = 1; n < colSpan2; n++)
                    {
                        num5 += list2[++m].GetWidth();
                    }
                    if (draw)
                    {
                        page.SetBrushColor(abstractCell2.GetBrushColor());
                        abstractCell2.Paint(page, num, num2, num5, num3, this.margin);
                    }
                    num += num5;
                }
                num   = this.x1;
                num2 += num3;
                if (l < this.tableData.Count - 1)
                {
                    List <AbstractCell> list3 = this.tableData[l + 1];
                    for (int num6 = 0; num6 < list3.Count; num6++)
                    {
                        AbstractCell abstractCell3 = list3[num6];
                        float        num7          = abstractCell3.GetComputedHeight(2f * this.margin) + 2f * this.margin;
                        if (num7 > num3)
                        {
                            num3 = num7;
                        }
                    }
                }
                if (num2 + num3 > page.height - this.bottom_margin)
                {
                    if (l == this.tableData.Count - 1)
                    {
                        this.rendered = -1;
                    }
                    else
                    {
                        this.rendered = l + 1;
                        this.numOfPages++;
                    }
                    return(new Point(num, num2));
                }
            }
            this.rendered = -1;
            return(new Point(num, num2));
        }