We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Draw Line Inside a row in pdflighttable ?

Hello i just want to know that how can we add a line inside a row in pdflighttable ? 

1 Reply

KC Karthikeyan Chandrasekar Syncfusion Team March 7, 2019 01:10 AM UTC

Hi Nouman, 
Greetings from Syncfusion. We can add a line to a row of PdfLightTable using the below code snippet. 
            //Create a new PDF document 
            PdfDocument document = new PdfDocument(); 
            //Add a page 
            PdfPage page = document.Pages.Add(); 
            //Create a PdfLightTable 
            PdfLightTable pdfLightTable = new PdfLightTable(); 
            //Create a DataTable 
            DataTable dataTable = new DataTable(); 
            //Add columns to data table 
            //Add row 
            //Assign data source 
            pdfLightTable.DataSource = dataTable; 
            pdfLightTable.BeginCellLayout += pdfLightTable_BeginCellLayout; 
            //Draw light table to the page of PDF document 
            pdfLightTable.Draw(page, new RectangleF(0, 50, page.GetClientSize().Width, page.GetClientSize().Height)); 
//Event handler to draw line in row 
        private void pdfLightTable_BeginCellLayout(object sender, BeginCellLayoutEventArgs args) 
            //Draw Line 
            if (args.CellIndex == 0) 
                //Draw Line 
                args.Graphics.DrawLine(PdfPens.Red, new PointF(args.Bounds.X, args.Bounds.Y+5),new PointF(args.Bounds.X+ args.Bounds.Width, args.Bounds.Y+5)); 
Kindly try this in your end and let us know if you need any further assistance on this. 

Live Chat Icon For mobile
Up arrow icon