Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfBorders

    Show / Hide Table of Contents

    Class PdfBorders

    The class used represents the cell border of the PDF grid

    Inheritance
    System.Object
    PdfBorders
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfBorders : Object
    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.

    Declaration
    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.

    Declaration
    public PdfPen All { set; }
    Property Value
    Type Description
    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.

    Declaration
    public PdfPen Bottom { get; set; }
    Property Value
    Type Description
    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.

    Declaration
    public static PdfBorders Default { get; }
    Property Value
    Type Description
    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.

    Declaration
    public PdfPen Left { get; set; }
    Property Value
    Type Description
    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.

    Declaration
    public PdfPen Right { get; set; }
    Property Value
    Type Description
    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.

    Declaration
    public PdfPen Top { get; set; }
    Property Value
    Type Description
    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)
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved