PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(5);
grid.Rows.Add().Height=25;
foreach (PdfGridRow row in grid.Rows)
{
foreach (PdfGridCell cell in row.Cells)
{
cell.Style.Borders.All = new PdfPen(Color.Black);
cell.Style.Borders.Bottom = new PdfPen(Color.Transparent);
cell.StringFormat = new PdfStringFormat(PdfTextAlignment.Justify, PdfVerticalAlignment.Middle);
}
}
PdfLayoutResult result = grid.Draw(page, new PointF(0, 10));
doc.SaveToFile("result.pdf");
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(5);
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
foreach (PdfGridRow row in grid.Rows)
{
foreach (PdfGridCell cell in row.Cells)
{
cell.Style.Borders.All = new PdfPen(System.Drawing.Color.Black);
cell.Style.Borders.Bottom = new PdfPen(System.Drawing.Color.Transparent);
cell.StringFormat = new PdfStringFormat(PdfTextAlignment.Justify, PdfVerticalAlignment.Middle);
}
}
PdfLayoutResult result = grid.Draw(page, new PointF(0, 10));
doc.SaveToFile("result.pdf");
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(5);
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
grid.Rows.Add().Height = 25;
for (int i=0; i<grid.Rows.Count;i++)
{
if (i==1 || i==2 || i== 3 || i == 4)
{
foreach (PdfGridCell cell in grid.Rows[i].Cells)
{
cell.Style.Borders.Top = new PdfPen(System.Drawing.Color.Transparent);
cell.Style.Borders.Bottom = new PdfPen(System.Drawing.Color.Transparent);
}
}
else
{
foreach (PdfGridCell cell in grid.Rows[i].Cells)
{
cell.Style.Borders.All = new PdfPen(System.Drawing.Color.Black);
}
}
}
PdfLayoutResult result = grid.Draw(page, new PointF(0, 10));
doc.SaveToFile("result.pdf");