PdfLightTable color rows in groups

How can I color PdfLightTable rows in groups rather than alternating colors?

Thanks

1 Reply

SK Sasi Kumar Sekar Syncfusion Team March 1, 2018 02:00 PM UTC

Hi Caleb, 
 
Thank you for contacting Syncfusion support. 
 
In PdfLightTable we can apply the style for the group of rows using BeginRowLayout Event by assigning the cellstyle to row. Here we have applied the style to the group of rows based on RowIndex property. 
Please find the code snippet and simple sample to apply style for the group of rows. 
Code snippet: 
     private void pdfLightTable_BeginRowLayout(object sender, BeginRowLayoutEventArgs args) 
        {            
            if (args.RowIndex <3) 
            { 
                PdfCellStyle cellstyle = new PdfCellStyle(); 
                cellstyle.BackgroundBrush = PdfBrushes.WhiteSmoke; 
                cellstyle.BorderPen = PdfPens.Brown;                 
                cellstyle.TextBrush = PdfBrushes.Blue; 
                cellstyle.TextPen = PdfPens.Black; 
                args.CellStyle = cellstyle; 
            } 
            if (args.RowIndex >=3) 
            { 
                PdfCellStyle cellstyle = new PdfCellStyle(); 
                cellstyle.BackgroundBrush = PdfBrushes.Brown; 
                cellstyle.BorderPen = PdfPens.Gray; 
                cellstyle.TextBrush = PdfBrushes.Blue; 
                cellstyle.TextPen = PdfPens.Black; 
                args.CellStyle = cellstyle; 
            } 
        } 
 
 
Sample: 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Sasi Kumar S. 


Loader.
Up arrow icon