private Point ImprovedDrawTableRows(Page page, bool draw, float[] parameter, System.IO.StreamReader p_file) { float x = parameter[0]; float y = parameter[1]; float cell_w = parameter[2]; float cell_h = parameter[3]; string[] v_line; for (int i = rendered; i < tableData.Count; i++) { List <Cell> dataRow = tableData[i]; cell_h = GetMaxCellHeight(dataRow); v_line = p_file.ReadLine().Split(';'); 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.ImprovedPaint(page, x, y, cell_w, cell_h, v_line[j]); } 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)); }