menu

ASP.NET Web Forms

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

    Show / Hide Table of Contents

    Class PdfGridRow

    Provides customization of the settings for the particular row.

    Inheritance
    System.Object
    PdfGridRow
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf.Grid
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfGridRow
    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;
    //Adding new Row
    PdfGridRow row = new PdfGridRow(pdfGrid);
    pdfGrid.Rows.Add(row);
    row.Cells[0].Value = "E03";
    row.Cells[1].Value = "Bran";
    //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
    'Adding new Row
    Dim row As New PdfGridRow(pdfGrid)
    pdfGrid.Rows.Add(row)
    row.Cells(0).Value = "E03"
    row.Cells(1).Value = "Bran"
    '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

    PdfGridRow(PdfGrid)

    Initializes a new instance of the PdfGridRow class with the parent grid.

    Declaration
    public PdfGridRow(PdfGrid grid)
    Parameters
    Type Name Description
    PdfGrid grid
    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;
    //Adding new Row
    PdfGridRow row = new PdfGridRow(pdfGrid);
    pdfGrid.Rows.Add(row);
    row.Cells[0].Value = "E03";
    row.Cells[1].Value = "Bran";
    //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
    'Adding new Row
    Dim row As New PdfGridRow(pdfGrid)
    pdfGrid.Rows.Add(row)
    row.Cells(0).Value = "E03"
    row.Cells(1).Value = "Bran"
    '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

    Cells

    Gets the cells from the selected row.[Read-Only]

    Declaration
    public PdfGridCellCollection Cells { get; }
    Property Value
    Type Description
    PdfGridCellCollection

    The cells.

    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;
    //Usage of cell collection
    pdfGrid.Rows[0].Cells[0].Value = "E03";
    //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
    'Usage of cell collection
    pdfGrid.Rows(0).Cells(0).Value = "E03"
    '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)

    Height

    Gets or sets the height of the row.

    Declaration
    public float Height { get; set; }
    Property Value
    Type Description
    System.Single

    The height.

    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;
    //Apply row height
    pdfGrid.Rows[0].Height = 100;
    //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
    'Apply row height
    pdfGrid.Rows(0).Height = 100
    '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)

    PdfTag

    Get or set the tag for the element

    Declaration
    public PdfTag PdfTag { get; set; }
    Property Value
    Type Description
    PdfTag
    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;
    //Apply row height
    pdfGrid.Rows[0].Height = 100;
    //Set PDF tag.
    pdfGrid.Rows[0].PdfTag = new PdfStructureElement(PdfTagType.TableRow);
    //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
    'Apply row height
    pdfGrid.Rows(0).Height = 100
    'Set PDF tag.
    pdfGrid.Rows(0).PdfTag = New PdfStructureElement(PdfTagType.TableRow)
    '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)

    Style

    Gets or sets the row style.

    Declaration
    public PdfGridRowStyle Style { get; set; }
    Property Value
    Type Description
    PdfGridRowStyle

    The row style.

    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;
    //Create row style
    PdfGridRowStyle rowStyle = new PdfGridRowStyle();
    rowStyle.BackgroundBrush = PdfBrushes.Cyan;
    //Apply style to the row
    pdfGrid.Rows[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
    'Create row style
    Dim rowStyle As New PdfGridRowStyle()
    rowStyle.BackgroundBrush = PdfBrushes.Cyan
    'Apply style to the row
    pdfGrid.Rows(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)

    Methods

    ApplyStyle(PdfGridCellStyle)

    Enables you to set the appearance of the row in a PdfGrid.

    Declaration
    public void ApplyStyle(PdfGridCellStyle cellStyle)
    Parameters
    Type Name Description
    PdfGridCellStyle cellStyle

    The cell style.

    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;
    //Create Cell Style
    PdfGridCellStyle style = new PdfGridCellStyle();
    style.TextBrush = PdfBrushes.Cyan;
    //Apply style to the specific row
    pdfGrid.Rows[0].ApplyStyle(style);
    //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
    'Create Cell Style
    Dim style As New PdfGridCellStyle()
    style.TextBrush = PdfBrushes.Cyan
    'Apply style to the specific row
    pdfGrid.Rows(0).ApplyStyle(style)
    '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 - 2025 Syncfusion Inc. All Rights Reserved