menu

ASP.NET Web Forms

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

    Show / Hide Table of Contents

    Class BeginCellLayoutEventArgs

    Represents arguments of StartCellLayout Event.

    Inheritance
    System.Object
    System.EventArgs
    CellLayoutEventArgs
    BeginCellLayoutEventArgs
    Inherited Members
    CellLayoutEventArgs.RowIndex
    CellLayoutEventArgs.CellIndex
    CellLayoutEventArgs.Value
    CellLayoutEventArgs.Bounds
    CellLayoutEventArgs.Graphics
    System.EventArgs.Empty
    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.Tables
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class BeginCellLayoutEventArgs : CellLayoutEventArgs
    Examples
    // Create a new document
    PdfDocument document = new PdfDocument();
    //Create a Page
    PdfPage page = document.Pages.Add();
    //Create DataTable for source
    DataTable dataTable = new DataTable("myTable");
    dataTable.Columns.Add("ID1");
    dataTable.Columns[0].Caption = "id";
    dataTable.Columns.Add("ID2");
    object[] values = new object[] { "Roll Number", "Student Name" };
    dataTable.Rows.Add(values);
    values = new object[] { "011", "Cris" };
    dataTable.Rows.Add(values);
    values = new object[] { "011", "Clay" };
    dataTable.Rows.Add(values);
    //Create the PdfLightTable
    PdfLightTable pdfLightTable = new PdfLightTable();
    // Subscribe the cell layout event
    pdfLightTable.BeginCellLayout += new BeginCellLayoutEventHandler(table_BeginCellLayout);
    pdfLightTable.DataSource = dataTable;
    pdfLightTable.Style.CellPadding = 16;
    //Draw PdfLightTable.
    pdfLightTable.Draw(page, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document
    document.Close(true);
    
    // Cell layout event handler
    void table_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)
    {
    if (args.RowIndex == 1)
    {
    args.Graphics.DrawRectangle(new PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds);
    }
    }
    ' Create a new document
    Dim document As New PdfDocument()
    'Create a Page
    Dim page As PdfPage = document.Pages.Add()
    'Create DataTable for source
    Dim dataTable As New DataTable("myTable")
    dataTable.Columns.Add("ID1")
    dataTable.Columns(0).Caption = "id"
    dataTable.Columns.Add("ID2")
    Dim values() As Object = { "Roll Number", "Student Name" }
    dataTable.Rows.Add(values)
    values = New Object() { "011", "Cris" }
    dataTable.Rows.Add(values)
    values = New Object() { "011", "Clay" }
    dataTable.Rows.Add(values)
    'Create the PdfLightTable
    Dim pdfLightTable As New PdfLightTable()
    ' Subscribe the cell layout event
    AddHandler pdfLightTable.BeginCellLayout, AddressOf table_BeginCellLayout
    pdfLightTable.DataSource = dataTable
    pdfLightTable.Style.CellPadding = 16
    'Draw PdfLightTable.
    pdfLightTable.Draw(page, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document
    document.Close(True)
    
    ' Cell layout event handler
    Private Sub table_BeginCellLayout(ByVal sender As Object, ByVal args As BeginCellLayoutEventArgs)
    If args.RowIndex = 1 Then
    args.Graphics.DrawRectangle(New PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds)
    End If
    End Sub

    Properties

    Skip

    Gets or sets a value indicating whether the value of this cell should be skipped.

    Declaration
    public bool Skip { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    // Create a new document
    PdfDocument document = new PdfDocument();
    //Create a Page
    PdfPage page = document.Pages.Add();
    //Create DataTable for source
    DataTable dataTable = new DataTable("myTable");
    dataTable.Columns.Add("ID1");
    dataTable.Columns[0].Caption = "id";
    dataTable.Columns.Add("ID2");
    object[] values = new object[] { "Roll Number", "Student Name" };
    dataTable.Rows.Add(values);
    values = new object[] { "011", "Cris" };
    dataTable.Rows.Add(values);
    values = new object[] { "011", "Clay" };
    dataTable.Rows.Add(values);
    //Create the PdfLightTable
    PdfLightTable pdfLightTable = new PdfLightTable();
    // Subscribe the cell layout event
    pdfLightTable.BeginCellLayout += new BeginCellLayoutEventHandler(table_BeginCellLayout);
    pdfLightTable.DataSource = dataTable;
    pdfLightTable.Style.CellPadding = 16;
    //Draw PdfLightTable.
    pdfLightTable.Draw(page, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document
    document.Close(true);
    
    // Cell layout event handler
    void table_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)
    {
    if (args.RowIndex == 1)
    {
    args.Graphics.DrawRectangle(new PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds);
    }
    if(args.RowIndex == 2)
    {
    args.Skip = true;
    }
    }
    ' Create a new document
    Dim document As New PdfDocument()
    'Create a Page
    Dim page As PdfPage = document.Pages.Add()
    'Create DataTable for source
    Dim dataTable As New DataTable("myTable")
    dataTable.Columns.Add("ID1")
    dataTable.Columns(0).Caption = "id"
    dataTable.Columns.Add("ID2")
    Dim values() As Object = { "Roll Number", "Student Name" }
    dataTable.Rows.Add(values)
    values = New Object() { "011", "Cris" }
    dataTable.Rows.Add(values)
    values = New Object() { "011", "Clay" }
    dataTable.Rows.Add(values)
    'Create the PdfLightTable
    Dim pdfLightTable As New PdfLightTable()
    ' Subscribe the cell layout event
    AddHandler pdfLightTable.BeginCellLayout, AddressOf table_BeginCellLayout
    pdfLightTable.DataSource = dataTable
    pdfLightTable.Style.CellPadding = 16
    'Draw PdfLightTable.
    pdfLightTable.Draw(page, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document
    document.Close(True)
    
    ' Cell layout event handler
    Private Sub table_BeginCellLayout(ByVal sender As Object, ByVal args As BeginCellLayoutEventArgs)
    If args.RowIndex = 1 Then
    args.Graphics.DrawRectangle(New PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds)
    End If
    if args.RowIndex =2 Then
    args.Skip = True
    End If
    End Sub

    See Also

    PdfDocument
    PdfLightTable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved