Tue Mar 28, 2017 6:37 pm
PdfGrid DemographicGrid = new PdfGrid();
DemographicGrid.Columns.Add(5);
PdfGridRow DemographicGridRow1 = DemographicGrid.Rows.Add();
PdfGridRow DemographicGridRow2 = DemographicGrid.Rows.Add();
width = page2.Canvas.ClientSize.Width - (DemographicGrid.Columns.Count + 1);
DemographicGrid.Columns[0].Width = width * 0.25f;
DemographicGrid.Columns[1].Width = width * 0.30f;
DemographicGrid.Columns[4].Width = width * 0.25f;
DemographicGrid.Style.CellPadding = new PdfPaddings(1, 1, 1, 1);
textAndStyle.Text = "Demographic Information";
DemographicGridRow1.Style.BackgroundBrush = PdfBrushes.LightBlue;
DemographicGridRow1.Cells[0].Value = textAndStyle.Text;
DemographicGridRow1.Cells[0].StringFormat = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle);
DemographicGridRow1.Cells[0].ColumnSpan = 5;
DemographicGridRow2.Cells[0].Value = fullNameAddress;
DemographicGridRow2.Cells[0].StringFormat = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle);
DemographicGridRow2.Cells[0].ColumnSpan = 3;
DemographicGridRow2.Cells[3].Value = "Phone: " + dd.Phone;
DemographicGridRow2.Cells[3].StringFormat = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle);
DemographicGridRow2.Cells[3].ColumnSpan = 2;
y += (DemographicGrid.Rows.Count * 0.66f);
// Paint Grids White = paintGrid(DemographicGrid);
OuterBoardersOnly(DemographicGrid, page2, y);
// Draw Grids
DemographicGrid.Draw(page2, new PointF(0, y));
////////////////////////////////////////////////////////////////////////////////////////////
// ONLY SHOW OUTER BOARDER OF GRID
public void OuterBoardersOnly(PdfGrid grid, PdfPageBase page, float y)
{
PdfBrush brush = new PdfSolidBrush(Color.Black);
PdfPen pen = new PdfPen(brush, 1);
for (int i = 0; i < grid.Rows.Count; i++)
{
for (int j = 0; j < grid.Rows[i].Cells.Count; j++)
{
//grid.Rows[i].Cells[j].Value = "test";
grid.Rows[i].Cells[j].Style.Borders.All = new PdfPen(new PdfTilingBrush(new SizeF(0.1f, 0.1f)));
if (i == 0)
{
grid.Rows[i].Cells[j].Style.Borders.Top = pen;
if (j == 0)
{
grid.Rows[i].Cells[j].Style.Borders.Left = pen;
}
else if (j == grid.Rows[i].Cells.Count - 1)
{
grid.Rows[i].Cells[j].Style.Borders.Right = pen;
}
}
else if (i == grid.Rows.Count - 1)
{
grid.Rows[i].Cells[j].Style.Borders.Bottom = pen;
if (j == 0)
{
grid.Rows[i].Cells[j].Style.Borders.Left = pen;
}
else if (j == grid.Rows[i].Cells.Count - 1)
{
grid.Rows[i].Cells[j].Style.Borders.Right = pen;
}
}
else if (j == 0)
{
grid.Rows[i].Cells[j].Style.Borders.Left = pen;
}
else if (j == grid.Rows[i].Cells.Count - 1)
{
grid.Rows[i].Cells[j].Style.Borders.Right = pen;
}
}
}
//grid.Draw(page, new PointF(0, y));
}