Esempio n. 1
0
        private float[] DrawHeaderRows(Page page, int pageNumber)
        {
            float x = x1;
            float y = (pageNumber == 1) ? y1FirstPage : y1;

            float cellH;

            for (int i = 0; i < numOfHeaderRows; i++)
            {
                List <Cell> dataRow = tableData[i];
                cellH = GetMaxCellHeight(dataRow);
                for (int j = 0; j < dataRow.Count; j++)
                {
                    Cell  cell    = dataRow[j];
                    float cellW   = cell.GetWidth();
                    int   colspan = cell.GetColSpan();
                    for (int k = 1; k < colspan; k++)
                    {
                        cellW += dataRow[++j].GetWidth();
                    }
                    if (page != null)
                    {
                        page.SetBrushColor(cell.GetBrushColor());
                        cell.Paint(page, x, y, cellW, cellH);
                    }
                    x += cellW;
                }
                x  = x1;
                y += cellH;
            }

            return(new float[] { x, y });
        }
Esempio n. 2
0
        private float[] DrawHeaderRows(Page page, bool draw)
        {
            float x      = x1;
            float y      = y1;
            float cell_w = 0f;
            float cell_h = 0f;

            for (int i = 0; i < numOfHeaderRows; i++)
            {
                List <Cell> dataRow = tableData[i];
                cell_h = GetMaxCellHeight(dataRow);

                for (int j = 0; j < dataRow.Count; j++)
                {
                    Cell  cell       = dataRow[j];
                    float cellHeight = cell.GetHeight();
                    if (cellHeight > cell_h)
                    {
                        cell_h = cellHeight;
                    }
                    cell_w = cell.GetWidth();
                    for (int k = 1; k < cell.GetColSpan(); k++)
                    {
                        cell_w += dataRow[++j].GetWidth();
                    }

                    if (draw)
                    {
                        page.SetBrushColor(cell.GetBrushColor());
                        cell.Paint(page, x, y, cell_w, cell_h);
                    }

                    x += cell_w;
                }
                x  = x1;
                y += cell_h;
            }

            return(new float[] { x, y, cell_w, cell_h });
        }
Esempio n. 3
0
        private float[] DrawTableRows(Page page, float[] parameter)
        {
            float x = parameter[0];
            float y = parameter[1];

            float cellH;

            for (int i = rendered; i < tableData.Count; i++)
            {
                List <Cell> dataRow = tableData[i];
                cellH = GetMaxCellHeight(dataRow);
                for (int j = 0; j < dataRow.Count; j++)
                {
                    Cell  cell    = dataRow[j];
                    float cellW   = cell.GetWidth();
                    int   colspan = cell.GetColSpan();
                    for (int k = 1; k < colspan; k++)
                    {
                        cellW += dataRow[++j].GetWidth();
                    }
                    if (page != null)
                    {
                        page.SetBrushColor(cell.GetBrushColor());
                        cell.Paint(page, x, y, cellW, cellH);
                    }
                    x += cellW;
                }
                x  = x1;
                y += cellH;

                // Consider the height of the next row when checking if we must go to a new page
                if (i < (tableData.Count - 1))
                {
                    List <Cell> nextRow = tableData[i + 1];
                    for (int j = 0; j < nextRow.Count; j++)
                    {
                        Cell  cell       = nextRow[j];
                        float cellHeight = cell.GetHeight();
                        if (cellHeight > cellH)
                        {
                            cellH = cellHeight;
                        }
                    }
                }

                if (page != null && (y + cellH) > (page.height - bottomMargin))
                {
                    if (i == tableData.Count - 1)
                    {
                        rendered = -1;
                    }
                    else
                    {
                        rendered = i + 1;
                        numOfPages++;
                    }
                    return(new float[] { x, y });
                }
            }
            rendered = -1;

            return(new float[] { x, y });
        }
Esempio n. 4
0
        private Point DrawTableRows(Page page, bool draw, float[] parameter)
        {
            float x      = parameter[0];
            float y      = parameter[1];
            float cell_w = parameter[2];
            float cell_h = parameter[3];

            for (int i = rendered; i < tableData.Count; i++)
            {
                List <Cell> dataRow = tableData[i];
                cell_h = GetMaxCellHeight(dataRow);

                for (int j = 0; j < dataRow.Count; j++)
                {
                    Cell  cell       = dataRow[j];
                    float cellHeight = cell.GetHeight();
                    if (cellHeight > cell_h)
                    {
                        cell_h = cellHeight;
                    }
                    cell_w = cell.GetWidth();
                    for (int k = 1; k < cell.GetColSpan(); k++)
                    {
                        cell_w += dataRow[++j].GetWidth();
                    }

                    if (draw)
                    {
                        page.SetBrushColor(cell.GetBrushColor());
                        cell.Paint(page, x, y, cell_w, cell_h);
                    }

                    x += cell_w;
                }
                x  = x1;
                y += cell_h;

                // Consider the height of the next row when checking if we must go to a new page
                if (i < (tableData.Count - 1))
                {
                    List <Cell> nextRow = tableData[i + 1];
                    for (int j = 0; j < nextRow.Count; j++)
                    {
                        Cell  cell       = nextRow[j];
                        float cellHeight = cell.GetHeight();
                        if (cellHeight > cell_h)
                        {
                            cell_h = cellHeight;
                        }
                    }
                }

                if ((y + cell_h) > (page.height - bottom_margin))
                {
                    if (i == tableData.Count - 1)
                    {
                        rendered = -1;
                    }
                    else
                    {
                        rendered = i + 1;
                        numOfPages++;
                    }
                    return(new Point(x, y));
                }
            }
            rendered = -1;

            return(new Point(x, y));
        }
Esempio n. 5
0
        public void DrawOn(Page page)
        {
            double x      = x1;
            double y      = y1;
            double cell_w = 0.0;
            double cell_h = 0.0;

            page.setPenWidth(lineWidth);
            page.SetPenColor(lineColor[0], lineColor[1], lineColor[2]);

            for (int i = 0; i < numOfHeaderRows; i++)
            {
                List <Cell> dataRow = tableData[i];
                for (int j = 0; j < dataRow.Count; j++)
                {
                    Cell cell = dataRow[j];
                    cell_h = cell.font.body_height + 2 * margin;
                    cell_w = cell.width;
                    for (int k = 1; k < cell.colspan; k++)
                    {
                        cell_w += dataRow[++j].width;
                    }

                    page.SetBrushColor(
                        cell.brushColor[0],
                        cell.brushColor[1],
                        cell.brushColor[2]);
                    cell.Paint(page, x, y, cell_w, cell_h, margin);

                    x += cell_w;
                }
                x  = x1;
                y += cell_h;
            }

            for (int i = rendered; i < tableData.Count; i++)
            {
                List <Cell> dataRow = tableData[i];
                for (int j = 0; j < dataRow.Count; j++)
                {
                    Cell cell = dataRow[j];
                    cell_h = cell.font.body_height + 2 * margin;
                    cell_w = cell.width;
                    for (int k = 1; k < cell.colspan; k++)
                    {
                        cell_w += dataRow[++j].width;
                    }

                    page.SetBrushColor(
                        cell.brushColor[0],
                        cell.brushColor[1],
                        cell.brushColor[2]);
                    cell.Paint(page, x, y, cell_w, cell_h, margin);

                    x += cell_w;
                }
                x  = x1;
                y += cell_h;

                if ((y + cell_h) > (page.height - bottom_margin))
                {
                    if (i == tableData.Count - 1)
                    {
                        rendered = -1;
                    }
                    else
                    {
                        rendered = i + 1;
                    }
                    return;
                }
            }

            rendered = -1;
        }
Esempio n. 6
0
        public Point DrawOn(Page page, bool draw)
        {
            float num  = this.x1;
            float num2 = this.y1;

            for (int i = 0; i < this.numOfHeaderRows; i++)
            {
                float       num3 = 0f;
                List <Cell> list = this.tableData[i];
                for (int j = 0; j < list.Count; j++)
                {
                    Cell  cell = list[j];
                    float num4 = cell.GetHeight() + 2f * this.padding;
                    if (num4 > num3)
                    {
                        num3 = num4;
                    }
                    float num5 = cell.GetWidth();
                    for (int k = 1; k < cell.GetColSpan(); k++)
                    {
                        num5 += list[++j].GetWidth();
                    }
                    if (draw)
                    {
                        page.SetBrushColor(cell.GetBrushColor());
                        cell.Paint(page, num, num2, num5, num3, this.padding);
                    }
                    num += num5;
                }
                num   = this.x1;
                num2 += num3;
            }
            for (int l = this.rendered; l < this.tableData.Count; l++)
            {
                float       num3  = 0f;
                List <Cell> list2 = this.tableData[l];
                for (int m = 0; m < list2.Count; m++)
                {
                    Cell  cell2 = list2[m];
                    float num6  = cell2.GetHeight() + 2f * this.padding;
                    if (num6 > num3)
                    {
                        num3 = num6;
                    }
                    float num5 = cell2.GetWidth();
                    for (int n = 1; n < cell2.GetColSpan(); n++)
                    {
                        num5 += list2[++m].GetWidth();
                    }
                    if (draw)
                    {
                        page.SetBrushColor(cell2.GetBrushColor());
                        cell2.Paint(page, num, num2, num5, num3, this.padding);
                    }
                    num += num5;
                }
                num   = this.x1;
                num2 += num3;
                if (l < this.tableData.Count - 1)
                {
                    List <Cell> list3 = this.tableData[l + 1];
                    for (int num7 = 0; num7 < list3.Count; num7++)
                    {
                        Cell  cell3 = list3[num7];
                        float num8  = cell3.GetHeight() + 2f * this.padding;
                        if (num8 > num3)
                        {
                            num3 = num8;
                        }
                    }
                }
                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));
        }