menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class QueryRowCountEventHandler - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class QueryRowCountEventHandler

    Represents the method for handling RowNumberEvent

    Inheritance
    System.Object
    QueryRowCountEventHandler
    Namespace: Syncfusion.Pdf.Tables
    Assembly: Syncfusion.Pdf.NET.dll
    Syntax
    public sealed class QueryRowCountEventHandler : MulticastDelegate
    Examples
    public string[][] datastring = new string[3][];
    // Specify values for the table
    datastring[0] = new string[] { "111", "Maxim", "100" };
    datastring[1] = new string[] { "222", "Calvin", "95" };
    datastring[2] = new string[] { "333", "Criss", "99" };
    // Create a new document
    PdfDocument document = new PdfDocument();
    //Create a Page
    PdfPage page = document.Pages.Add();
    //Create the PdfLightTable
    PdfLightTable pdfLightTable = new PdfLightTable();
    // Setting the DataSourceType as Direct
    pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External;
    //Subscribing Events
    pdfLightTable.QueryRowCount += new QueryRowCountEventHandler(table_QueryRowCount);
    pdfLightTable.QueryColumnCount += new QueryColumnCountEventHandler(table_QueryColumnCount);
    pdfLightTable.QueryNextRow += new QueryNextRowEventHandler(table_QueryNextRow);
    //Draw PdfLightTable.
    pdfLightTable.Draw(page, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document
    document.Close(true);
    
    void table_QueryColumnCount(object sender, QueryColumnCountEventArgs args)
    {
    args.ColumnCount = 3;
    }
    
    void table_QueryNextRow(object sender, QueryNextRowEventArgs args)
    {
    if (datastring.Length > args.RowIndex )
    args.RowData = new string[] { datastring[args.RowIndex][0], datastring[args.RowIndex][1], datastring[args.RowIndex][2] };
    }
    
    void table_QueryRowCount(object sender, QueryRowCountEventArgs args)
    {
    args.RowCount = 2;
    }
    Public datastring(2)() As String
    ' Specify values for the table
    datastring(0) = New String() { "111", "Maxim", "100" }
    datastring(1) = New String() { "222", "Calvin", "95" }
    datastring(2) = New String() { "333", "Criss", "99" }
    ' Create a new document
    Dim document As New PdfDocument()
    'Create a Page
    Dim page As PdfPage = document.Pages.Add()
    'Create the PdfLightTable
    Dim pdfLightTable As New PdfLightTable()
    ' Setting the DataSourceType as Direct
    pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External
    'Subscribing Events
    AddHandler pdfLightTable.QueryRowCount, AddressOf table_QueryRowCount
    AddHandler pdfLightTable.QueryColumnCount, AddressOf table_QueryColumnCount
    AddHandler pdfLightTable.QueryNextRow, AddressOf table_QueryNextRow
    'Draw PdfLightTable.
    pdfLightTable.Draw(page, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document
    document.Close(True)
    
    Private Sub table_QueryColumnCount(ByVal sender As Object, ByVal args As QueryColumnCountEventArgs)
    args.ColumnCount = 3
    End Sub
    
    Private Sub table_QueryNextRow(ByVal sender As Object, ByVal args As QueryNextRowEventArgs)
    If datastring.Length > args.RowIndex Then
    args.RowData = New String() { datastring(args.RowIndex)(0), datastring(args.RowIndex)(1), datastring(args.RowIndex)(2) }
    End If
    End Sub
    
    Private Sub table_QueryRowCount(ByVal sender As Object, ByVal args As QueryRowCountEventArgs)
    args.RowCount = 2
    End Sub

    Constructors

    QueryRowCountEventHandler(Object, IntPtr)

    Declaration
    public QueryRowCountEventHandler(object object, IntPtr method)
    Parameters
    Type Name Description
    System.Object object
    System.IntPtr method

    Methods

    BeginInvoke(Object, QueryRowCountEventArgs, AsyncCallback, Object)

    Declaration
    public virtual IAsyncResult BeginInvoke(object sender, QueryRowCountEventArgs args, AsyncCallback callback, object object)
    Parameters
    Type Name Description
    System.Object sender
    QueryRowCountEventArgs args
    System.AsyncCallback callback
    System.Object object
    Returns
    Type
    System.IAsyncResult

    EndInvoke(IAsyncResult)

    Declaration
    public virtual void EndInvoke(IAsyncResult result)
    Parameters
    Type Name Description
    System.IAsyncResult result

    Invoke(Object, QueryRowCountEventArgs)

    Declaration
    public virtual void Invoke(object sender, QueryRowCountEventArgs args)
    Parameters
    Type Name Description
    System.Object sender
    QueryRowCountEventArgs args

    See Also

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