Table of Contents

Class PdfBorders

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

The class used represents the cell border of the PDF grid

public class PdfBorders
Inheritance
PdfBorders
Inherited Members

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.All = PdfPens.Blue;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.All = PdfPens.Blue
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Constructors

PdfBorders()

Initialize a new instance of the PdfBorders class.

public PdfBorders()

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.All = PdfPens.Blue;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.All = PdfPens.Blue
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Properties

All

Sets all.

public PdfPen All { set; }

Property Value

PdfPen

All.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.All = PdfPens.Blue;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.All = PdfPens.Blue
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Bottom

Gets or sets the bottom.

public PdfPen Bottom { get; set; }

Property Value

PdfPen

The bottom.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.Left = PdfPens.Red;
border.Right = PdfPens.Blue;
border.Top = PdfPens.Green;
border.Bottom = PdfPens.Orange;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
pdfGrid.Style.CellSpacing = 2;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.Left = PdfPens.Red
border.Right = PdfPens.Blue
border.Top = PdfPens.Green
border.Bottom = PdfPens.Orange
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
pdfGrid.Style.CellSpacing = 2
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Default

Gets the default border.

public static PdfBorders Default { get; }

Property Value

PdfBorders

The default.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = PdfBorders.Default;
border.All = PdfPens.Blue;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As PdfBorders = PdfBorders.Default
border.All = PdfPens.Blue
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Left

Gets or sets the left.

public PdfPen Left { get; set; }

Property Value

PdfPen

The left.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.Left = PdfPens.Red;
border.Right = PdfPens.Blue;
border.Top = PdfPens.Green;
border.Bottom = PdfPens.Orange;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
pdfGrid.Style.CellSpacing = 2;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.Left = PdfPens.Red
border.Right = PdfPens.Blue
border.Top = PdfPens.Green
border.Bottom = PdfPens.Orange
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
pdfGrid.Style.CellSpacing = 2
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Right

Gets or sets the right.

public PdfPen Right { get; set; }

Property Value

PdfPen

The right.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.Left = PdfPens.Red;
border.Right = PdfPens.Blue;
border.Top = PdfPens.Green;
border.Bottom = PdfPens.Orange;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
pdfGrid.Style.CellSpacing = 2;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.Left = PdfPens.Red
border.Right = PdfPens.Blue
border.Top = PdfPens.Green
border.Bottom = PdfPens.Orange
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
pdfGrid.Style.CellSpacing = 2
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Top

Gets or sets the top.

public PdfPen Top { get; set; }

Property Value

PdfPen

The top.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid cell style
PdfGridCellStyle rowStyle = new PdfGridCellStyle();
//Creating Border
PdfBorders border = new PdfBorders();
border.Left = PdfPens.Red;
border.Right = PdfPens.Blue;
border.Top = PdfPens.Green;
border.Bottom = PdfPens.Orange;
//setting border to the style
rowStyle.Borders = border;
//Applying style to grid
pdfGrid.Rows[0].Cells[0].Style = rowStyle;
pdfGrid.Style.CellSpacing = 2;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid.
Dim pdfGrid As New PdfGrid()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() {"E01", "Clay"})
dataTable.Rows.Add(New Object() {"E02", "Thomas"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid cell style
Dim rowStyle As New PdfGridCellStyle()
'Creating Border
Dim border As New PdfBorders()
border.Left = PdfPens.Red
border.Right = PdfPens.Blue
border.Top = PdfPens.Green
border.Bottom = PdfPens.Orange
'setting border to the style
rowStyle.Borders = border
'Applying style to grid
pdfGrid.Rows(0).Cells(0).Style = rowStyle
pdfGrid.Style.CellSpacing = 2
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)